I am reading Linear Congruences in Dudley's Elementary Number Theory. I am having trouble following a part of the proof.
There is another theorem referenced in the proof I will call Theorem 4.5: If $ac \equiv bc \pmod m$ and $gcd(c,m) = d$, then $a \equiv b \pmod {m/d}$.
The lemma reads as follows:
For the linear congruence $ax\equiv b \pmod m$, let $d=gcd(a,m)$. If $d|b$, then $ax\equiv b \pmod m$ has exactly $d$ solutions.
Proof:
If we cancel the common factor, we get a congruence $(a/d)x \equiv (b/d) \pmod {(m/d)}$, which we know has exactly one solution because $gcd(a/d, m/d)=1$. Call it $r$, and let $s$ be any other solution of $ax\equiv b \pmod m$.
Then $ar \equiv as \equiv b \pmod m$, and it follows from Theorem 4.5 that $r \equiv s \pmod {m/d}$. That is, $s-r = k(m/d)$ or $s=r + k(m/d)$ for some $k$. Putting $k=0, 1, ...,(d-1)$, we get numbers which are least residues modulus $m$, since
$$
0\le r + k(m/d) \lt (m/d) + (d - 1)(m/d) = m, (1)
$$
and they all satisfy $ax\equiv b \pmod m$ because
$$
(a/d)(r + k(m/d))\equiv (a/d)r \equiv b/d \pmod {m/d}
$$
and this implies
$$
a(r+k(m/d))\equiv b\pmod m.
$$
End of Proof (couldn't figure out how to generate the QED symbol.).
My question is: in the equation marked (1) above, where does the expression $(m/d)+(d-1)(m/d)$ come from? I understand that usually $0\le r \lt m-1$, and in this case the author uses $s=r+k(m/d)$ for $k=0,1,...,(d-1)$ as the general solution, so I can see where $(d-1)$ comes from, but I am missing something.