Let p be a prime number, and k is a positive integer.

(a) Show that if x is an integer such that x^2 is congruent to x mod p, then x is congruent to 0 or 1 mod p.

(b) Show that if x is an integer such that x^2 is congruent to x mod p^k, then x is congruent to 0 or 1 mod p^k.