[step:Define the Cohen real and decode it into a function on $\mathbb{N}$]Let $\langle \cdot,\cdot\rangle: \mathbb{N} \times \mathbb{N} \to \mathbb{N}$ be a fixed bijection in $M$. We view Cohen forcing $\mathbb{C}$ as the partially ordered set of finite partial functions $p: \mathbb{N} \rightharpoonup \{0,1\}$, ordered by extension: $q \leq p$ means $q \supseteq p$.
Let $\dot c$ be the canonical $\mathbb{C}$-name for the generic binary sequence, and define its interpretation $c = \dot c^G$ in $M[G]$ as follows. For each $k \in \mathbb{N}$, let $H_k = \{p \in \mathbb{C} : k \in \operatorname{dom}(p)\}$. Given $p \in \mathbb{C}$, choose $i \in \{0,1\}$ and define $q = p \cup \{(k,i)\}$ if $k \notin \operatorname{dom}(p)$, while if $k \in \operatorname{dom}(p)$ set $q=p$. Then $q \leq p$ and $q \in H_k$, so $H_k$ is dense in $\mathbb{C}$. Since $H_k \in M$ and $G$ is $M$-generic, there is $p \in G \cap H_k$. Define $c: \mathbb{N} \to \{0,1\}$ by declaring $c(k)$ to be the unique value $i \in \{0,1\}$ such that some $p \in G$ satisfies $p(k)=i$. Existence follows from $G \cap H_k \neq \varnothing$, and uniqueness follows because any two conditions in the filter $G$ are compatible, so they cannot assign different values to the same coordinate.
For each $n \in \mathbb{N}$, define the dense set
\begin{align*}
E_n = \{p \in \mathbb{C} : \text{there exists } k \in \mathbb{N} \text{ such that } p(\langle n,k\rangle)=1\}.
\end{align*}
Given $p \in \mathbb{C}$, choose $k \in \mathbb{N}$ such that $\langle n,k\rangle \notin \operatorname{dom}(p)$, which is possible because $\operatorname{dom}(p)$ is finite. Then $q = p \cup \{(\langle n,k\rangle,1)\}$ is a condition with $q \leq p$ and $q \in E_n$. Thus $E_n$ is dense in $\mathbb{C}$. Since $E_n \in M$ and $G$ is $M$-generic, $G \cap E_n \neq \varnothing$.
Therefore, for each $n \in \mathbb{N}$, there exists $k \in \mathbb{N}$ with $c(\langle n,k\rangle)=1$. Let $\dot f$ be the $\mathbb{C}$-name for the decoded function obtained from $\dot c$, and let $f=\dot f^G$ be its interpretation in $M[G]$. Define $f: \mathbb{N} \to \mathbb{N}$ by
\begin{align*}
f(n) = \min\{k \in \mathbb{N} : c(\langle n,k\rangle)=1\}.
\end{align*}
The preceding paragraph proves that the set over which the minimum is taken is nonempty for every $n$, so $f$ is a total function in $M[G]$.[/step]