[proofplan]
The proof has two parts. First, the valence formula bounds the possible order of vanishing at the cusp of a nonzero modular form, and a linear-algebra argument converts this into an upper bound for $\dim_{\mathbb{C}} M_k(SL_2(\mathbb{Z}))$. The exceptional congruence class $k \equiv 2 \pmod{12}$ appears because the remaining weighted zero contribution would have to equal $1/6$, which is impossible from the elliptic weights $1/2$ and $1/3$. Second, explicit modular forms built from the normalized Eisenstein series and the discriminant form $\Delta$ have distinct orders at infinity, giving the matching lower bound.
[/proofplan]
[step:Eliminate negative and odd weights]
Let $\mathbb{H} := \{z \in \mathbb{C} : \operatorname{Im}(z) > 0\}$ denote the complex upper half-plane. For a modular form $f \in M_k(SL_2(\mathbb{Z}))$, the matrix $-I \in SL_2(\mathbb{Z})$ gives the transformation law
\begin{align*}
f(z) = (-1)^k f(z)
\end{align*}
for every $z \in \mathbb{H}$. Hence if $k$ is odd, then $f(z) = -f(z)$ for every $z \in \mathbb{H}$, so $f = 0$ and $M_k(SL_2(\mathbb{Z})) = \{0\}$.
Now suppose $k < 0$ and let $f \in M_k(SL_2(\mathbb{Z}))$ be nonzero. We use the valence formula for full level modular forms (citing a result not yet in the wiki: Valence Formula for $SL_2(\mathbb{Z})$). Let
\begin{align*}
\rho := e^{2\pi i/3}.
\end{align*}
If $v_\infty(f)$ denotes the order of vanishing of the $q$-expansion of $f$ at the cusp, $v_i(f)$ denotes the order of vanishing at $i$, $v_\rho(f)$ denotes the order of vanishing at $\rho$, and $v_p(f)$ denotes the order of vanishing at any other point $p$ of the quotient $SL_2(\mathbb{Z}) \backslash \mathbb{H}$, then
\begin{align*}
v_\infty(f)
+ \frac{1}{2}v_i(f)
+ \frac{1}{3}v_\rho(f)
+ \sum_{\substack{p \in SL_2(\mathbb{Z}) \backslash \mathbb{H}\\ p \neq i,\rho}} v_p(f)
= \frac{k}{12}.
\end{align*}
Every term on the left-hand side is nonnegative, while $k/12 < 0$. This contradiction proves $M_k(SL_2(\mathbb{Z})) = \{0\}$ for $k < 0$.
[/step]
[step:Convert the valence formula into the sharp upper bound]
Assume from now on that $k \geq 0$ is even. Write
\begin{align*}
k = 12m + r,
\end{align*}
where $m := \left\lfloor k/12 \right\rfloor$ and $r \in \{0,2,4,6,8,10\}$.
Let $f \in M_k(SL_2(\mathbb{Z}))$ be nonzero. By the valence formula,
\begin{align*}
v_\infty(f) \leq \frac{k}{12} = m + \frac{r}{12}.
\end{align*}
Since $v_\infty(f) \in \mathbb{Z}_{\geq 0}$, this gives $v_\infty(f) \leq m$.
If $r = 2$, the stronger estimate $v_\infty(f) \leq m - 1$ holds. Indeed, if $v_\infty(f) = m$, then the valence formula gives
\begin{align*}
\frac{1}{2}v_i(f)
+ \frac{1}{3}v_\rho(f)
+ \sum_{\substack{p \in SL_2(\mathbb{Z}) \backslash \mathbb{H}\\ p \neq i,\rho}} v_p(f)
= \frac{1}{6}.
\end{align*}
Multiplying by $6$, this would imply
\begin{align*}
3v_i(f) + 2v_\rho(f)
+ 6\sum_{\substack{p \in SL_2(\mathbb{Z}) \backslash \mathbb{H}\\ p \neq i,\rho}} v_p(f)
= 1.
\end{align*}
The left-hand side is a nonnegative integer linear combination of $2$, $3$, and $6$, and cannot equal $1$. Therefore $v_\infty(f) \neq m$, so $v_\infty(f) \leq m-1$ when $k \equiv 2 \pmod{12}$.
Now let $d := \dim_{\mathbb{C}} M_k(SL_2(\mathbb{Z}))$. If $d = 0$, there is nothing to prove. Suppose $d \geq 1$, and choose a basis $f_1,\dots,f_d$ of $M_k(SL_2(\mathbb{Z}))$. For each $j \in \{1,\dots,d\}$, write the $q$-expansion
\begin{align*}
f_j(z) = \sum_{n=0}^{\infty} a_n(f_j) q^n,
\qquad q := e^{2\pi i z}.
\end{align*}
The conditions that a linear combination $\sum_{j=1}^d c_j f_j$ have its first $d-1$ Fourier coefficients equal to zero are $d-1$ homogeneous linear equations in the $d$ complex unknowns $c_1,\dots,c_d$. Hence there exists a nonzero vector $(c_1,\dots,c_d) \in \mathbb{C}^d$ such that
\begin{align*}
f := \sum_{j=1}^d c_j f_j
\end{align*}
is nonzero and satisfies $v_\infty(f) \geq d-1$.
Combining this with the order bounds above gives
\begin{align*}
d \leq m+1
\end{align*}
in all even weights, and gives the sharper bound
\begin{align*}
d \leq m
\end{align*}
when $k \equiv 2 \pmod{12}$.
[/step]
[step:Construct enough forms with distinct orders at infinity]
We use the standard full-level Eisenstein series and discriminant form (citing results not yet in the wiki: Holomorphy and Modularity of Normalized Eisenstein Series; Modular Discriminant Form). For every even integer $\ell$ with $\ell = 0$ or $\ell \geq 4$, choose a modular form
\begin{align*}
E_\ell \in M_\ell(SL_2(\mathbb{Z}))
\end{align*}
whose $q$-expansion has the form
\begin{align*}
E_\ell(z) = 1 + O(q),
\end{align*}
where $E_0$ is the constant function $1$. Also let
\begin{align*}
\Delta \in S_{12}(SL_2(\mathbb{Z}))
\end{align*}
be the normalized discriminant modular form, whose $q$-expansion has the form
\begin{align*}
\Delta(z) = q + O(q^2).
\end{align*}
First suppose $r \neq 2$. For each integer $j$ with $0 \leq j \leq m$, define
\begin{align*}
h_j := \Delta^j E_{k-12j}.
\end{align*}
Since products of modular forms add weights, $h_j \in M_k(SL_2(\mathbb{Z}))$. The weight $k-12j$ is an even integer equal to $0$ or at least $4$, so the chosen form $E_{k-12j}$ exists. The $q$-expansion satisfies
\begin{align*}
h_j(z) = q^j + O(q^{j+1}),
\end{align*}
so $v_\infty(h_j) = j$.
Because the forms $h_0,\dots,h_m$ have distinct first nonzero $q$-powers, they are linearly independent. Indeed, if
\begin{align*}
\sum_{j=0}^m c_j h_j = 0
\end{align*}
and $j_0$ is the least index with $c_{j_0} \neq 0$, then the coefficient of $q^{j_0}$ in the sum is $c_{j_0}$, a contradiction. Therefore
\begin{align*}
\dim_{\mathbb{C}} M_k(SL_2(\mathbb{Z})) \geq m+1
\end{align*}
when $r \neq 2$.
Now suppose $r = 2$. If $m = 0$, the upper bound from the previous step already gives $\dim_{\mathbb{C}} M_2(SL_2(\mathbb{Z})) = 0$. If $m \geq 1$, then for each integer $j$ with $0 \leq j \leq m-1$, define
\begin{align*}
h_j := \Delta^j E_{k-12j}.
\end{align*}
Here $k-12j = 12(m-j)+2 \geq 14$, so $E_{k-12j}$ exists. Again $h_j \in M_k(SL_2(\mathbb{Z}))$ and
\begin{align*}
h_j(z) = q^j + O(q^{j+1}).
\end{align*}
The same lowest-power argument proves that $h_0,\dots,h_{m-1}$ are linearly independent. Hence
\begin{align*}
\dim_{\mathbb{C}} M_k(SL_2(\mathbb{Z})) \geq m
\end{align*}
when $k \equiv 2 \pmod{12}$.
[/step]
[step:Combine the matching upper and lower bounds]
For even $k \geq 0$ with $k = 12m + r$ and $r \in \{0,2,4,6,8,10\}$, the upper bound gives
\begin{align*}
\dim_{\mathbb{C}} M_k(SL_2(\mathbb{Z})) \leq
\begin{cases}
m, & r = 2,\\
m+1, & r \neq 2,
\end{cases}
\end{align*}
and the explicit constructions give the reverse inequalities. Therefore
\begin{align*}
\dim_{\mathbb{C}} M_k(SL_2(\mathbb{Z})) =
\begin{cases}
m, & r = 2,\\
m+1, & r \neq 2.
\end{cases}
\end{align*}
Since $m = \left\lfloor k/12 \right\rfloor$ and $r = 2$ is equivalent to $k \equiv 2 \pmod{12}$, this is exactly
\begin{align*}
\dim_{\mathbb{C}} M_k(SL_2(\mathbb{Z}))
=
\begin{cases}
\left\lfloor \dfrac{k}{12} \right\rfloor, & k \equiv 2 \pmod{12},\\
\left\lfloor \dfrac{k}{12} \right\rfloor + 1, & k \not\equiv 2 \pmod{12}.
\end{cases}
\end{align*}
Together with the negative-weight and odd-weight cases proved above, this completes the proof.
[/step]