We play the following card game:

We are given a deck with $M$ cards in different colors $c\in\left\{ 1,\dots,C\right\}$. There are $D$ cards from each color, so $M=CD$.

We wish to place a subset of $N$ cards from the deck on a board with “card locations” $n\in\left\{ 1,\dots,N\right\}$. Each location is painted with a set of colors $P_n \subset \{1,\dots,C\}$. Assume that any color can be painted on at most $D-1$ locations.

In each location we must place:

1) A card with a color $c$, for each the color $c \in P_n$.

2) An additional card with a color $c \notin P_n $.

The question is: **When does a solution exist?**

It is easy to show the following necessary conditions for the existence of a solution:

(1) $\forall n:\,|P_{n}|<C$

(2) $M \geq\sum_{n=1}^{N}|P_{n}|+N$.

Find sufficient and necessary conditions, or as strong a possible sufficient conditions.

Any help would be appreciated, thanks in advance!