This question already has an answer here:
Here's what I have:
$ax \equiv b (mod\ m)$ has answer if there are $x$ and $y$ such that
$b = ax + my$
Let $d = gcd(a,m)$. Then:
$d|a$ and $d|m \Leftrightarrow d|ax$ and $d|my \Leftrightarrow d|(ax+my)$
Since $m$ divides the right part of the equation, it also has to divide the left part.
Is this a valid proof for what I want?