Let $X_1, X_2,\ldots$ be a sequence of independent and identically distributed non-negative integer valued random variables, and let $N$ be a non-negative integer valued random variable which is independent of the sequence $X_1,X_2,\ldots$. Let $Z = X_1+X_2+\ldots+X_N$ (where we take $Z=0$ if $N=0$).
(a) Show that $\mathbb{E}[Z] = \mathbb{E}[N] \mathbb{E}[X_1]$.
(b) Suppose we remove the condition that $N$ is independent of the sequence ($X_i$). Is it still necessarily the case that $\mathbb{E}[Z] = \mathbb{E}[N] \mathbb{E}[X_1]$? Find a proof or a counterexample.
I had no problem proving part (a), but am struggling with part (b). Any advice on how to approach part (b) would be greatly appreciated.