How can I prove this by using contradiction?
Given the premises, assume that there does exists an integer $b$ such that $ab \equiv 1 \pmod m.$
Then, let $k = \frac{ab - 1}{m},$ where $k \in \mathbb Z$.
So, $$ab = km + 1, b = \frac{km+1}{a} = \frac{km}a + \frac 1a.$$
Then I try to prove $km/a$ is an integer since I know $1/a$ is not.