Say you've got $B$ buckets, each having a particular discreet capacity $c_b, 1\leq b\leq B$. Then you want to distribute all of $I$ of identical items. How many possible combinations do you have.
For example you have $I=3$ items and $B=4$ buckets with capacities $c_1=3, c_2=2, c_3=2, c_4=1$. Is there a (smart) way to determine that there exist only 14 possible valid combinations?
Here the answer I gave in comments while this question was on Mathoverflow does probably belong as a proper answer, so I may as well reproduce it so that this question can be marked as answered and not float around.
The answer is, of course, "the coefficient of $x^I$ in $\frac{(1−x^{c_1+1})\cdots(1−x^{c_B+1})}{(1−x)^B}$", because this fraction is equal to $\prod_{b=1}^B(1+x+\cdots+x^{c_b})$, and hence manifestly enumerates exactly what you want (the distribution of items between the boxes is read from which power you take from each bracket when forming a term $x^I$).
Remark: If you expand the numerator, you will get an alternating sum which provides an inclusion-exclusion formula Steve Huntsman is asking for in his comment.