In how many ways we can distribute $15$ apples to $4$ students if each of the first two students has to get at most $4$ apples? In how many ways we can distribute $15$ apples to $4$ students if each of the first two students has to get at most $4$ apples?  
I know how to solve these types of problems if it were to ask "at least" or "an even/odd amount," but because the question asks that two of the students get "at most $4$ apples" is making it more difficult for me to solve. I tried to use generating and I end up with $f(x)=(1-x^5)^2 \cdot (1-x)^{-4}$, then I would have to expand and find the coefficient of $x^{15}$ but I am not sure if this is correct, there has to be a more efficient solution. I tried doing exponential generating functions but I got stuck at an earlier step.  
So how do I solve the types of questions with the constraint that some number of people must get "at most" of something? Is there a different method besides generating functions or is there an intelligent solution to these types of problems?  
I do not want a solution to the original question, just a hint.
 A: The generating function for distributing $n$ apples to these students is
$$
\begin{align}
&\left(1+x+x^2+x^3+x^4\right)^2\left(1+x+x^2+x^3+x^4+x^5+\dots\right)^2\\
&=\frac{\left(1-x^5\right)^2}{(1-x)^4}\\
&=\left(1-2x^5+x^{10}\right)\sum_{n=0}^\infty(-1)^n\binom{-4}{n}x^n\\
&=\left(1-2x^5+x^{10}\right)\sum_{n=0}^\infty\binom{n+3}{n}x^n\\
&=\sum_{n=0}^\infty\left[\binom{n+3}{n}-2\binom{n-2}{n-5}+\binom{n-7}{n-10}\right]x^n\\
\end{align}
$$
For $n=15$, we get
$$
\binom{18}{15}-2\binom{13}{10}+\binom{8}{5}=300
$$
A: You could certainly use the inclusion-exclusion principle here.
Say, without loss, that students 1 and 2 are the ones with the restriction. Let $A$ be the set of configurations you want.  Let $A_1$ be the configurations in which student 1's restriction is violated, $A_2$ the configurations in which student 2's restriction is violated, and $A_{1,2}$ the configurations in which both restrictions are violated. Then
$$
\lvert A\rvert=\binom{15}{4}-(\lvert A_1\rvert+\lvert A_2\rvert)+\lvert A_{1,2}\rvert=\binom{15}{4}-(\lvert A_1\rvert+\lvert A_2\rvert)+\lvert A_1\cap A_2\rvert.
$$
