set x to the number you want to find the multiplicative inverse of, and set y to the modulus. Then just let this take over.