I have an equation $$x \cdot a \equiv b\pmod m$$ where $a$ and $b$ are known and $m$ is a prime number.
I want to solve for $x$. If $b=1$ then $x=a^{m-2}$ but I need to solve it for any value of $b$.
I found this answer which seems to work but is there an easier way if $m$ is prime ?