Reverse number modulo m
📁 Advanced Python Topics, example
Two integers M and a are given. If there is no modular inverse of a modulo M, then output -1, and if it exists, then output this number (the answer should be in the range from 0 to m-1).
The only line of input contains two integers 1
Output. Output the answer to the problem.
Sample Input 179 57 Output 22
b = 0
a = list(map(int, input().split()))
b = pow(a[1], a[0] - 2,