Consider a≡b (mod m)
By the divison lemma, a = km+r (0<r<m)
Consider a≡b (mod p, a prime factor of m)
By the division lemma, a = gp + r' (0<r'<p)
m = px (as a prime factor of m)
gp + r' = km + r
((gm)/x) + r' = km + r
m((g/x)-k) = r - r'
Now if the remainders were the same, then (g/x)-k = 0. I'm not sure how to prove this, or where to go from here..