The discrete square root problem is as follows.

Input. Positive integers x and m where m > 1.

Output Either a positive integer y so that y2x (mod m) or an indication that no such y exists.

For example, 4 is a discrete square root of 2 (mod 7), since 42 = 16 ≡ 2 (mod 7).