Showing that the index of two groups is a power of $2$
up vote
1
down vote
favorite
I am trying to understand a proof (from a book) that there are at most $(n-1)/4$ non-wittnesses against the primality of $n$ in the Miller-Rabin algorithm that are coprime to $n$ . We set the prime factorisation of $n$ to $n = prod_{p | n} p^{e(p)}$ . In one passage the author considers the following two subgroups of $mathbb{Z}_n^{times}$ $K = { a + nmathbb{Z} : gcd(a,n) = 1 text{ and } a^{n-1} equiv pm 1 text{ mod } p^{e(p)} text{ for all primes $p$ such that } p | n}$ $M = { a + nmathbb{Z} : gcd(a,n) = 1 text{ and } a^{m} equiv 1 text{ mod } n}$ . He observes that $M le K$ which is clear. Then he says that the index $(K : M)$ is a power of $2$ since the square of each element of $K$ is an element in $M$ . I can not follow this argumentation, could you please explain that to me?