For a prime $p$, $p$ divides $\sum_{i=1}^{p-1}i^k$ if and only if $p-1$ does not divide $k$. Thus for two primes you may simply suppise that $p_1<p_2$, then $p_1p_2-1\equiv p_1-1 \pmod{p_2-1}$ is not divisible by $p_2-1$.
Fedor Petrov
- 108.9k
- 9
- 264
- 459