Let $M$ be a positive integer, and let $X_1, X_2, \dots$ be i.i.d. r.v.'s having uniform distribution in the set $\{1, \dots, M\}$. For given $N$, let $Z_N$ denote the number of *distinct* elements of the set $\{X_1, \dots, X_N\}$.

Question: What is the distribution of $Z_N$?

(In the end, I want to estimate how large $N$ has to be such that $Z_N$ is close to $M$ with high probability. For example, how large does $N$ have to be such that $Z_N > 0.9 M$ with probability at least $1/2$?)