Answer: (p,a,m)=(2,1,1),(2,3,2),(2,7,3),(3,1,1),(3,7,2),(3,25,3),(5,1,2),(2,15,4),(5,101,3).
Direct checks for p=2,3,5 give the above solutions.
For p≥7 the Wilson theorem implies a≡1(modp). Moreover, obviously p−1∣a−1. Therefore a=kp(p−1)+1 for some integer k≥0. If k≥6 then a≥6p2−6p+1>5p2, a contradiction. So we have 0≤k≤5.
After division by p−1 we obtain
(p−2)!+kp=pm−1+pm−2+⋯+1.
Since p≥7, the 2 and 2p−1 are different and appear in (p−2)!, i.e. p−1∣(p−2)!. This gives k≡m(modp−1).
If m≥p, then
(p−2)!+kp=pm−1+pm−2+⋯+1>pp−1>(p−1)!,
which easily gives a contradiction. Thus m≤p−1.
If k=0, then m=p−1 and
(p−2)!=pm−1≥pp−1−1>(p−1)p−1>(p−1)!,
a contradiction. If k=1 or 2, then m=1 or 2, respectively, which is impossible. If k=3, then m=3, i.e. (p−2)!=(p−1)2, which is impossible.
For k=4 we get m=4 and (p−2)!=(p−1)(p2+2p−1), whence
p−2∣p2+2p−1=p2−4+2(p−2)+7,
i.e. p=7, which does not give solutions. For k=5 we obtain m=5 and (p−2)!=(p−1)(p3+2p2+3p−1), whence
p−2∣p3+2p2+3p−1=p3−8+2(p2−4)+3(p−2)+21,
i.e. p=7, which does not give solutions.