<s>[INST] How can I count solutions to $x_1 + \ldots + x_n = N$? I am interested in how many non-negative integer solutions there are to:
$$x_1 + \ldots + x_N = B$$
where at least $K$ of the variables $x_1, \ldots , x_N \geq C$
For example when:
$B = 5, N = 3, K = 2, C = 2$
I want to count the solutions to:
$$x_1 + x_2 + x_3 = 5$$
where at least $2$ of the variables are $\geq 2$.
I found the total number of candidate solutions using the $\binom{B+N-1}{B} = 21$
However, only $9$ of them have two variables $\geq 2$.
\begin{align*}
    2+0+3& =5\\
    2+1+2& =5\\
    3+0+2& =5\\
    1+2+2& =5\\
    3+2+0& =5\\
    0+2+3& =5\\
    0+3+2& =5\\
    2+3+0& =5\\
    2+2+1& =5
\end{align*}
I feel there is a connection to the Associated Stirling numbers of the second kind. But I can't place it :(
EDIT:
Here is my code for enumerating them all to count the number of ways of select B elements from a set of N (uniformly with replacement), such that you have at least C copies of K elements - also shows the output for this question I'm asking here as it's the core piece. Obviously can't be run for very large values of the parameters - that's why I'm here :) Code is here
Here is another example for B = 6, N = 3, C = 2 and K = 2 there are 16 solutions:
\begin{align*}
0+2+4& = 6\\
0+3+3& = 6\\
0+4+2& = 6\\
1+2+3& = 6\\
1+3+2& = 6\\
2+0+4& = 6\\
2+1+3& = 6\\
2+2+2& = 6\\
2+3+1& = 6\\
2+4+0& = 6\\
3+0+3& = 6\\
3+1+2& = 6\\
3+2+1& = 6\\
3+3+0& = 6\\
4+0+2& = 6\\
4+2+0& = 6\\
\end{align*}
There are a number of different and correct solutions below. I don't know which to accept. 
 [/INST] Without loss of generalization, let us consider $x_1,x_2,\ldots,x_k \geq C$.
Then let
$$y_i = \begin{cases}x_i - C &i\leq k\\ x_i & i > k \end{cases}$$
Solving 
$$\left\{\begin{array}[lll] xx_1 + x_2 + \ldots + x_n &=& N\\ x_i \geq 0& &  \\ x_1,x_2,\ldots,x_k& \geq & C\end{array}\right.$$ 
is equivalent to just solving 
$$\left\{\begin{array}[lll] yy_1 + y_2 + \ldots + y_n &=& N-kC\\ y_i \geq 0& &\end{array}\right.$$  The number of solutions excluding permutations is the number of partitions of $N-kC$ into $m$ integers where $m \leq n$.
For each of this solutions, adding $C$ to $k$ of them would yield a solution of your original problem. There are $n\choose k$ ways to do thus but we are overcounting some solutions if there are $i,j$ such that $y_i = y_j$ or if $y_i + C = y_j$. For each of this solutions we have at most $n!$ distinct solutions (including permutations), again we are overcounting some if there are $i,j$ such that $y_i = y_j$ or if $y_i + C = y_j$. This gives us a somewhat close upper bound on the amount of solutions:
$${n\choose k} n!\sum_{m=1}^n P_m(N-kC)$$
</s>