For a set of $n$ numbers, you have $n$ "degrees of freedom".
Generally speaking, each condition you impose loses a degree of freedom.
Naively, you would assume $(n-2)$ degrees of freedom after imposing two conditions on $n$ variables.
However, the sum $S$ and mean $M$ are closely related: $S=nM$.
For example, say you have three numbers with sum 30 and mean 10. Then you need $x_1+x_2+x_3=30$ and $\frac{1}{3}(x_1+x_2+x_3)=10$. But this last condition is equivalent to $x_1+x_2+x_3=30$.
Say you have three numbers with the sum 30 and the mean 5. Then you need $x_1+x_2+x_3=30$ and $\frac{1}{3}(x_1+x_2+x_3)=5$. This last condition is equivalent to $x_1+x_2+x_3=15$, and so you need $15=30$ which is impossible; there are no such numbers.
In short, if the sum and mean are compatible, i.e. $S=nM$, then you have one, and only one, condition:
$$x_1+\cdots+x_n=S$$
You need to know the number of partitions of $S$.