from what you have
a = km + b
b = a - km
b is divisible by gcd(a,m)
similarly
a is divisible by gcd(b.m)
so gcd(a,m), gcd(b,m) are divisors of a,b and m
so gcd(a,m)<= gcd(b,m)
also gcd(b,m) <= gcd(a,m)
hence we conclude they are equal.
good luck next week