Find an example of this random variable. X is a discrete random variable such that for some $M > 0$ we have $E(X) =
E(\min(X,M))$. Prove that $P(X > M) = 0$. And find an example of this random variable.
I have finished the proof part,
but I could not come up with an example of this random variable.

This is just asking for a bounded random variable. If $M$ is an upper bound on $X$, then the term on the RHS reduces to $E(X)$ so all you need to do is pick a bounded random variable (say the indicator) and pick an upper bound for it (for the indicator this could be $1$ or anything greater than $1$).
