inverse modulo for non primes

is it possible to find the solution of following:


ie inverse of 9 modulo M

where 2<=M<=10^9 it may not be a prime and gcd(9,M) may not be 1

if not possible to find such a solution is there any method to solve:



take modulo M*9 instead of M and after that divide your answer by 9.