9. $M \in \mathbf{Z}, M^{2}+M+7$ is a perfect square, then $M=$
\begin{array}{l}\text { 9. }-7,-2,1,6 \\ M^{2}+M+7=(M+1)^{2}-M+6=(M+2)^{2}-3 M+3 \text {. } \\ \text { When } M6 \text {, }(M+1)^{2}<M^{2}+M+7<(M+2)^{2} \text {. } \\ \text { Therefore }-7 \leqslant M \leqslant 6 \text {. }\end{array}