I'm reading trough a proof that the number of (group) homomorphisms $\mathbb{Z}_n\rightarrow \mathbb{Z}_m$ is $$\text{gcd}(n, m),$$ and this is the only step that I'm not understanding, namely, that the number of solutions to the equation $na\equiv _m0$ for $0\leq a <m$ is $\text{gcd}(n,m)$.
I would appreciate any help.