Let $k$ be a field of characteristic prime to $5$.  Denote $\text{Proj}\ k[x_0,x_1,x_2,x_3]$ with $\text{deg}(x_i)=1$ by $\mathbb{P}^3_k.$  Denote by $G$ the following copy of $\mu_5$ inside $\textbf{PGL}_4$, $$\rho:\mu_5 \to \textbf{PGL}_4, \ \ \zeta\cdot[x_0,x_1,x_2,x_3] = [\zeta^0x_0,\zeta^1x_1,\zeta^2x_2,\zeta^3x_3].$$  The following quintic Fermat surface $Y$ is invariant under this action, $$Y = \text{Zero}(x_0^5+x_1^5+x_2^5+x_3^5) \subset \mathbb{P}^3_k.$$  The induced action of $G$ on $Y$ is free.  Denote the quotient by this action as follows, $$f:Y\to X.$$  This is a finite, &eacute;tale morphism of degree $5$.  The surface $X$ is a <b>Godeaux surface</b>.  The dimensions $h^q(X,\Omega^p_{X/k})$ are as follows, $$ \begin{array}[ccccc] & & & 1 & & \\ & 0 & & 0 & \\ 0 & & 9 & & 0 \\  & 0 & & 0 & \\   & & 1 & &  \end{array}.$$  In particular, in characteristic $0$, the second Betti number equals $9$ and the geometric genus equals $0$, so that $b_2-p_g-2$ equals $9-0-2$, i.e., $7$.

On the other hand, by the Griffiths residue calculus (or other means), the group $H^1(X,T_X) = H^1(Y,T_Y)^G$ is the $G$-invariant vector subspace of the degree $5$ graded piece of the Jacobian ring, $$k[x_0,x_1,x_2,x_3]/\text{Jac}(Y) = k[x_0,x_1,x_2,x_3]/\langle x_0^4,x_1^4,x_2^4,x_3^4 \rangle.$$  The $G$-invariant subspace has basis consisting of monomials $x_0^{e_0}x_1^{e_1}x_2^{e_2}x_3^{e_3}$ such that $e_0+e_1+e_2+e_3=5$, such that every $e_i \leq 3$, and such that $0e_0+1e_1+2e_2+3e_3$ is divisible by $5$.  It is straightforward to check that this defines the following $8$ monomials,
$$\{ x_3^3x_1x_0, x_3^2x_2^2x_0,x_3^2x_2x_1^2,x_3x_2^3x_1,x_3x_2x_0^3,x_3x_1^2x_0^2, x_2^2x_1x_0^2,x_2x_1^3x_0\}.$$  Thus, $h^1(X,T_X)$ equals $8$.  Also, by Serre duality, $$h^3(\mathbb{P}^3_k,T_{\mathbb{P}^3}(-\underline{Y})) = h^0(\mathbb{P}^3_k,\omega_{\mathbb{P}^3/k}\otimes \Omega_{\mathbb{P}^3/k}(\underline{Y})) = h^0(\mathbb{P}^3_k, \Omega_{\mathbb{P}^3/k}(1)).$$  Using the Euler sequence, this last cohomology group is zero.  Thus, also $H^2(Y,T_Y)$ equals $0$ (maybe there is a faster computation of that), so that $H^2(Y,T_Y)^G$ is zero.  In other words, $H^2(X,T_X)$ is zero. Therefore, the infinitesimal deformations of $X$ are unobstructed.  Finally, $H^0(Y,T_Y)$ equals $0$, so that also $H^0(X,T_X)=H^0(Y,T_Y)^G$ is zero.  

Altogether, the versal deformation space of $X$ is smooth of dimension $8$, without any infinitesimal automorphisms.  So the integer $M$ equals $8$.  Yet $8$ is strictly greater than $7$.