[proofplan]
Let $N$ be the submodule generated by the proposed generators $x_1,\ldots,x_k$. The hypothesis that their residue classes span $M/\mathfrak{m}M$ is exactly the statement that every element of $M$ lies in $N+\mathfrak{m}M$. Passing to the quotient $Q=M/N$, this becomes $Q=\mathfrak{m}Q$. Since $Q$ is finitely generated, [Nakayama's Lemma](/theorems/2935) forces $Q=0$, and hence $M=N$.
[/proofplan]
[step:Translate residue spanning into the equality $M=N+\mathfrak{m}M$]
Define the $R$-submodule $N \subset M$ by
\begin{align*}
N := Rx_1+\cdots+Rx_k.
\end{align*}
We claim that $M=N+\mathfrak{m}M$.
Let $y \in M$. Since the residue classes $x_1+\mathfrak{m}M,\ldots,x_k+\mathfrak{m}M$ generate $M/\mathfrak{m}M$ as an $R/\mathfrak{m}$-[vector space](/page/Vector%20Space), there exist residue classes $a_1+\mathfrak{m},\ldots,a_k+\mathfrak{m} \in R/\mathfrak{m}$ such that
\begin{align*}
y+\mathfrak{m}M = \sum_{i=1}^{k} (a_i+\mathfrak{m})(x_i+\mathfrak{m}M)
\end{align*}
in $M/\mathfrak{m}M$. Equivalently,
\begin{align*}
y-\sum_{i=1}^{k} a_i x_i \in \mathfrak{m}M.
\end{align*}
The element $\sum_{i=1}^{k} a_i x_i$ lies in $N$, so $y \in N+\mathfrak{m}M$. Since $y \in M$ was arbitrary, $M \subset N+\mathfrak{m}M$. The reverse inclusion holds because $N \subset M$ and $\mathfrak{m}M \subset M$, so
\begin{align*}
M=N+\mathfrak{m}M.
\end{align*}
[guided]
The goal is to convert the vector-space spanning hypothesis into an equality of $R$-submodules of $M$. Define
\begin{align*}
N := Rx_1+\cdots+Rx_k.
\end{align*}
This is the smallest $R$-submodule of $M$ containing $x_1,\ldots,x_k$. We want to prove that every element of $M$ differs from an element of $N$ by an element of $\mathfrak{m}M$.
Take an arbitrary element $y \in M$. Its residue class in the [quotient module](/page/Quotient%20Module) is $y+\mathfrak{m}M \in M/\mathfrak{m}M$. By hypothesis, the residue classes $x_i+\mathfrak{m}M$ span this quotient as a vector space over the residue field $R/\mathfrak{m}$. Therefore there are coefficients $a_1+\mathfrak{m},\ldots,a_k+\mathfrak{m} \in R/\mathfrak{m}$ such that
\begin{align*}
y+\mathfrak{m}M = \sum_{i=1}^{k} (a_i+\mathfrak{m})(x_i+\mathfrak{m}M).
\end{align*}
Here each $a_i \in R$ is a chosen representative of the corresponding residue class.
The scalar multiplication in $M/\mathfrak{m}M$ is induced from the scalar multiplication on $M$, so the displayed equality is the same as
\begin{align*}
y+\mathfrak{m}M = \left(\sum_{i=1}^{k} a_i x_i\right)+\mathfrak{m}M.
\end{align*}
Two elements of $M$ define the same coset modulo $\mathfrak{m}M$ precisely when their difference lies in $\mathfrak{m}M$. Hence
\begin{align*}
y-\sum_{i=1}^{k} a_i x_i \in \mathfrak{m}M.
\end{align*}
The finite sum $\sum_{i=1}^{k} a_i x_i$ belongs to $N$ by the definition of $N$. Thus $y$ is a sum of an element of $N$ and an element of $\mathfrak{m}M$, so $y \in N+\mathfrak{m}M$. Since $y$ was arbitrary, $M \subset N+\mathfrak{m}M$. The opposite containment follows from $N \subset M$ and $\mathfrak{m}M \subset M$, giving
\begin{align*}
M=N+\mathfrak{m}M.
\end{align*}
[/guided]
[/step]
[step:Pass to the quotient and obtain $M/N=\mathfrak{m}(M/N)$]
Define the quotient $R$-module
\begin{align*}
Q := M/N.
\end{align*}
Since $M$ is finitely generated and $Q$ is a quotient of $M$, the module $Q$ is finitely generated.
We prove that $Q=\mathfrak{m}Q$. Let $q \in Q$. Then $q=y+N$ for some $y \in M$. From $M=N+\mathfrak{m}M$, there exist $n \in N$, an integer $\ell \ge 0$, elements $b_1,\ldots,b_\ell \in \mathfrak{m}$, and elements $z_1,\ldots,z_\ell \in M$ such that
\begin{align*}
y=n+\sum_{j=1}^{\ell} b_j z_j.
\end{align*}
Passing to $Q$, we get
\begin{align*}
q=y+N=\sum_{j=1}^{\ell} b_j(z_j+N) \in \mathfrak{m}Q.
\end{align*}
Thus $Q \subset \mathfrak{m}Q$. The reverse inclusion $\mathfrak{m}Q \subset Q$ is immediate from the module structure, so
\begin{align*}
Q=\mathfrak{m}Q.
\end{align*}
[/step]
[step:Apply Nakayama's Lemma to force the quotient to vanish]
We apply Nakayama's Lemma in the following form: if $(R,\mathfrak{m})$ is a commutative local ring and $Q$ is a finitely generated $R$-module satisfying $Q=\mathfrak{m}Q$, then $Q=0$.
The hypotheses are satisfied: $R$ is local with maximal ideal $\mathfrak{m}$ by assumption, $Q=M/N$ is finitely generated because it is a quotient of the [finitely generated module](/page/Finitely%20Generated%20Module) $M$, and the previous step proved $Q=\mathfrak{m}Q$. Therefore Nakayama's Lemma gives
\begin{align*}
Q=0.
\end{align*}
[/step]
[step:Conclude that the proposed elements generate $M$]
Since $Q=M/N$ and $Q=0$, every coset of $N$ in $M$ is zero. Hence $M=N$. By the definition
\begin{align*}
N=Rx_1+\cdots+Rx_k,
\end{align*}
this says exactly that $x_1,\ldots,x_k$ generate $M$ as an $R$-module. This proves the theorem.
[/step]