So I'm going through Niven's The Theory of Numbers, and it gives the definition that:
$$a \equiv b \pmod m \implies m \mid (a - b)$$
However, a few pages after this definition, it gives a theorem that states "if $\gcd(a, m) = 1$, then there is an $x$ such that $ax \equiv 1 \pmod m$. To prove this theorem, it states that:
If $\gcd(a, m) = 1$, then there exist $x, y$ such that $ax + my = 1.$ That is, $ax \equiv 1 \pmod m$.
Well... from $ax + my = 1$, you can get $my = 1 - ax$, but this shows that $m \mid (1 - ax)$.
However, from the aforementioned definition of an equivalence class, $ax \equiv 1 \pmod m \implies m \mid (ax - 1)$, rather than $m \mid (1 - ax)$.
What is happening here?