Let $X_i$ be a random variable with value 1 when box $i$ is empty and 0 otherwise. Now $P(X_i=1)=(1-\frac{1}{40})^{80}$. P(X_i=1)=(1-\frac{1}{N})^{M}$. And the expected number of empty boxes is just$\mathbb{E}(\sum X_i)=40\mathbb{E}(X_1)\approx X_i)=N\mathbb{E}(X_1)\approx \frac{40}{e^2}$frac{N}{e^M}$
Let $X_i$ be a random variable with value 1 when box $i$ is empty and 0 otherwise. Now $P(X_i=1)=(1-\frac{1}{40})^{80}$. And the expected number of empty boxes is just $\mathbb{E}(\sum X_i)=40\mathbb{E}(X_1)\approx \frac{40}{e^2}$