Counting integer partitions of n into exactly k distinct parts size at most M How can I find the number of partitions of $n$ into exactly $k$ distinct parts, where each part is at most $M$?
The number of partitions $p_k(\leq M,n)$ of $n$ into at most $k$ parts, each of size at most $M$, is given by the generating function:
$$
 \binom{M+k}{k}_{x} = \prod_{j=1}^{k}\frac{1-x^{M+k-j+1}}{1-x^j}= \sum_{n=0}^{kM} p_{k}(\leq M,n) x^n
$$
For the number of the partitions $p_k(\mathcal{D},n)$ of $n$ into at most $k$ parts there is the recurrence relationship:
$$
  p_{k}(\mathcal{D},n) = p_{k}(\mathcal{D},n-k) + p_{k-1}(\mathcal{D},n)
$$
But what, if I want to count only the partitions with distinct parts and restricted number of parts and restricted part size?
Update: Now I know the generating function for the number of distinct restricted partitions $p_k(\leq M, \mathcal{D},n)$ of $n$ into exactly $k$ distinct parts, all at most $M$ is
$$
   \prod_{j=1}^{M} (1+xq^{j}) = \sum_{k,n=0}^{\infty}p_k(\leq M, \mathcal{D},n)x^{k}q^{n}
$$
and there is also a recurrence relation
$$
   p_k(\leq M, \mathcal{D},n) =    
    p_{k-1}(\leq M-1, \mathcal{D},n-k) +    
    p_k(\leq M-1, \mathcal{D},n-k)
$$
How can I prove this? Could you recommend a book, where I could read about this?

There is an algorithm to count and generate restricted numerical partitions (both in largest part and number of parts) in F. Ruskey's book Combinatorial Generation (p. 95) Sec. 4.8 Numerical Partitions:

Define $P(n; k; s)$ to be the set of all partitions of $n$ into $k$
  parts with largest part equal to $s$, and let $p(n; k; s) = \left|P(n;
 k; s)\right|$. Clearly, in order to have $p(n; k; s) > 0$ we must have
  at least one part equal to $s$ and at most $k$ parts equal to $s$.
  Thus $s + k \le n \le ks$.
By classifying the partitions of $P(n; k; s)$ according to the value
  of the second largest part, call it $j$, we obtain the following
  recurrence relation, which has no zero terms; it is a positive
  recurrence relation.
$$p(n; k; s) = \sum^{\min(s,n-s-k+2)}_{j=\max(1,\lceil\frac{n-s}{k-1}\rceil)}p(n-s;k-1;j) \tag{4.35}$$

