Prove that the congruence $ax \equiv b $ mod $m$ has a solution if and only if $d | b$, where $d = $gcd$(a,m)$
I thought about proving using the contrapositive that $d$ does not divide $b$, but i'm not sure that would really help and am stumped as to where to start.
Some help would be great!