Let $p$ be a fixed prime. Determine all the integers $m$, as function of $p$, such that there exist $a_1, a_2, \ldots, a_p \in \mathbb{Z}$ satisfying
\[m \mid a_1^p + a_2^p + \cdots + a_p^p - (p+1).\]
To determine all integers \( m \) as a function of \( p \) such that there exist \( a_1, a_2, \ldots, a_p \in \mathbb{Z} \) satisfying
\[ m \mid a_1^p + a_2^p + \cdots + a_p^p - (p+1), \]
we need to analyze the divisibility condition for different values of \( m \).

1. **Prime Power Analysis**:
   We start by considering \( m = q^a \) where \( q \) is a prime and \( a \) is a positive integer. We need to check if the congruence
   \[ a_1^p + a_2^p + \cdots + a_p^p \equiv p+1 \pmod{q^a} \]
   has a solution with at least one \( a_i \) not divisible by \( q \).

2. **Case \( q \neq p \)**:
   If \( q \neq p \), we use Hensel's lemma. If the congruence
   \[ a_1^p + \cdots + a_p^p \equiv p+1 \pmod{q} \]
   has a solution with at least one \( a_i \) not divisible by \( q \), then by Hensel's lemma, the congruence
   \[ a_1^p + \cdots + a_p^p \equiv p+1 \pmod{q^b} \]
   also has a solution for every \( b \leq 2a \) (and thus for all \( b \geq 1 \) by induction).

3. **Case \( q = p \)**:
   If \( q = p \) and \( p > 2 \), we need to check if there exists a solution for \( a = 2 \). For \( p \) odd, we use the fact that \( p \mid \binom{p}{2} \). This allows us to go from a solution to \( f(x) \equiv x^p - u \pmod{p^s} \) for \( p \nmid x \) to a solution modulo \( p^{2s-1} \) of the form \( x + tp^{s-1} \).

4. **Checking \( a = 1 \) and \( (p, q) \neq (2, 3) \)**:
   For \( a = 1 \) and \( (p, q) \neq (2, 3) \), we check if
   \[ a_1^p + \cdots + a_p^p \equiv p+1 \pmod{q} \]
   has a solution with not all \( a_i \) divisible by \( q \). This is obvious when \( q \nmid p+1 \). If \( q \mid p+1 \), we can take \( (1, -1, 0, \ldots, 0) \) since \( (p, q) \neq (2, 3) \) forces \( p > 2 \).

5. **Case \( p = 2 \) or \( p = 3 \)**:
   For \( p = 2 \) or \( p = 3 \), we use the fact that squares are \( 0, 1 \pmod{4} \) and cubes are \( 0, \pm 1 \pmod{9} \). Thus, there is no solution for \( p = 2 \) or \( p = 3 \).

6. **Case \( p > 3 \)**:
   For \( p > 3 \), we try to find a solution with \( a_p = 1 \). By Fermat's Little Theorem, it suffices to find \( b_1, \ldots, b_{p-1} \) such that \( v_p(b_1^p + \cdots + b_{p-1}^p) = 1 \). One of \( 2^p - 2 \) or \( 2^p - 2 + p \) is not divisible by \( p^2 \), so we can take \( (2, -1, -1, 0, \ldots, 0) \) or \( (2, 1, \ldots, 1) \) accordingly.

Conclusion:
The integers \( m \) such that there exist \( a_1, a_2, \ldots, a_p \in \mathbb{Z} \) satisfying \( m \mid a_1^p + a_2^p + \cdots + a_p^p - (p+1) \) are all integers of the form \( m = q^a \) where \( q \) is a prime and \( a \) is a positive integer, except for the cases when \( p = 2 \) or \( p = 3 \).

The final answer is \( \boxed{ m = q^a } \) for \( q \) prime and \( a \) positive integer, except for \( p = 2 \) or \( p = 3 \).