Let's say I have three known numbers : $a$, $b$ and $m$.
I want to find the smallest $x$ so that $a.x \equiv b\ (mod\ m)$ (the product of $a$ and $b$ is congruent to $b$ modulo $m$).
In the cases where such an $x$ exists, is there a simple equation that allows me to get the value for $x$ ?
Note: the numbers $a$, $b$ and $m$ can be very large numbers. I am looking for a direct resolution of the equation, not a solution involving iterating through all possible values of $x$ or modular-rewriting of $a$ and $b$.