I hope this is your own question not a homework question.

---

It is not always possible. For example, x^(b-1)=1 (mod b) where b is not a prime or a power of a prime. This is based on the integers under multiplication and addition modulo b form a field. Since we are dealing with a field b is either prime or a power of a prime.

Furthermore, if (b-1) does not divide n then there is no solution. This is based the the order of an element most divide the order of the group. Which in this case is not satisfied.

Thus, you made your problem too general. And let me also add that there is no general method of finding:

x^2=a(mod p)