Range of modulo inverse

If B is modular multiplicative inverse of A under mod M where ( A.B=1 mod M ) . Find the exact range of B.

How do we get the range here ?

See this thread Challenges - Number Theory

How did we get to that relation of range being [1, M-1] from (A.B = 1 mod M) ?

Would you kindly explain how we got there ? Maybe mathematically or analytically