We have, for both congruences, if $p$ is a prime dividing $m$, then $p-1$ also divides $m$, and $p^2$ doesn't divide $m$; conversely, if $m$ satisfies these properties, then it works in both congruences. No Bernoulli numbers are necessary.
Let $p$ be a prime dividing $m$. Then $\sum_{n=1}^mn^m\equiv1\pmod p$$\sum_{n=1}^mn^m\equiv1\bmod p$, so $(m/p)\sum_{n=1}^{p-1}n^m\equiv1\pmod p$$(m/p)\sum_{n=1}^{p-1}n^m\equiv1\bmod p$, so $p^2$ doesn't divide $m$. Let $g$ be a primitive root mod $p$. Then $\sum_{n=1}^{p-1}n^m\equiv\sum_{r=0}^{p-2}g^{rm}$. That's a geometric series, it sums to $(1-g^{(p-1)m})/(1-g^m)$ which is zero mod $p$ - unless $g^m=1$, in which case it sums to $-1$ mod $p$. So we must have $p-1$ dividing $m$.
Now look at the other congruence, $n^{m+1}\equiv n\pmod m$$n^{m+1}\equiv n\bmod m$. Letting $n=p$, we see that $p^2$ can't divide $m$. Now looking mod $p$, we get $n^{m+1}\equiv n\pmod p$$n^{m+1}\equiv n\bmod p$. This is equivalent to $m+1\equiv1\pmod{p-1}$$m+1\equiv1\bmod{p-1}$, that is, $p-1$ divides $m$.
It's not hard to show that the only $m$ such that for every prime $p$ dividing $m$ we have $p-1$ divides $m$ and $p^2$ doesn't divide $m$ are those numbers 1, 2, 6, 42, and 1806. First show that if any prime divides $m$ then 2 divides $m$. The if more than one prime divides $m$ show that the second smallest must be 3. Then if more than 2 primes divide $m$ the third smallest must be 7. And so on.