Here on this pdf on page no $5$ it is stated that
Let $g = (a, m)$. Then there is a solution to $ax \equiv b \mod m$ if and only if $g|b$. If it has solutions, then it has exactly $g$ solutions $\mod m$.
I do not understand the proof that it has exactly $g$ solutions. How we conclude the second last and last sentence on the pdf?