Let phi be Euler's totient function. Since gcd(a, m)=1, we can use (Z/mZ)* to help us answer your question. If we move things around, ax-1 has to be divisible by m (since ax-1=my). Letting x=a^(phi(m)-1), we get a^(phi(m))-1=m*y. Both sides are divisible by m. (a^(phi(m))-1)/m is also an integer. So far, at least one solution to the Diophante equation exists; (x, y)=(a^(phi(m)-1), (a^(phi(m))-1)/m).
Lets prove now there are infinitely many solutions. To do this, a change of variables for simplification is much nicer; p=a and q=m. since gcd(p, q)=1, p= p'+nq, where p' is p reduced mod q. We have
Substitute x-> x'+(p')^(-1)
[(p')^(-1) is the inverse of (p') in (Z/qZ); (p')(p')^(-1)=kq+1]
Since we have gcd(p, q)=1, the ordered pair solution (x', y') must be (zq, zp), for integers z. Working our way back to find the original x and y solution, we get
So it happens that there is not only one but infinitely many solutions!