Using the fundamental theorem of number theory we can write $m$ as a product of primes $$m=\prod_i p_i^{\alpha_i}.$$ By theorem 2.3 part (3) in the book, which is some sort of chinese remainder theorem, it suffices to show that $a^m\equiv a^{m-\phi(m)}$ modulo $p_i^{\alpha_i}$ for each $i$. So fix an arbitrary $i$, and write $m=p_i^{\alpha_i} m^{\prime}$, with $\operatorname{gcd}\left(m^{\prime}, p_i\right)=1$. Then by theorem 2.19, $$\phi(m)=\left(p^{\alpha_i}-p^{\alpha_i-1}\right) \phi\left(m^{\prime}\right).$$
Now consider two cases. If $\left(a, p_i\right)=1$, then
$$
a^{\phi\left(p_i^{\alpha_i}\right)}=a^{\left(p^{\alpha_i}-p^{\alpha_i-1}\right)} \equiv 1 \pmod{p_i^{\alpha_i}},
$$
so
$$
a^{m-\phi(m)} \equiv a^{m-\phi(m)} \cdot\left(a^{\left(p^{\alpha_i}-p^{\alpha_i-1}\right)}\right)^{m^{\prime}} \equiv a^m \pmod{p_i^{\alpha_i}}
$$
and so the result holds in this case.
The second case is if $p_i \mid a$. In this case, we claim that both numbers are congruent to $0$ modulo $p_i^{\alpha_i}$. Write $a=p_i a^{\prime}$ for some $a^{\prime}$, and note that both $m$ and $$\phi(m)=\left(p^{\alpha_i}-p^{\alpha_i-1}\right) \phi\left(m^{\prime}\right)$$ are divisible by $p_i^{\alpha_i-1}$. Therefore, on both sides of the congruence we have factors of $p^{p_i^{\alpha_i-1}}$. Since $p_i^{\alpha_i-1} \geq \alpha_i$, this implies that both sides are congruent to $0$.