Think of a pair \((m_1, m_2) \in M \times M\) as the formal difference “\(m_1 - m_2\)”. Define \(M^{\mathrm{gp}} := (M \times M)/\!\sim\text{,}\) where \((m_1, m_2) \sim (n_1, n_2)\) if there exists \(k \in M\) with
\begin{equation*}
m_1 + n_2 + k \;=\; m_2 + n_1 + k.
\end{equation*}
Without the extra summand \(k\) this would be the usual rule for equality of differences. The summand is needed because \(M\) need not have cancellation, and without it the relation can fail to be transitive. Componentwise addition makes \(M^{\mathrm{gp}}\) a commutative monoid, and it is a group because \((m_1, m_2) + (m_2, m_1) = (m_1 + m_2, m_1 + m_2) \sim (0,0)\text{.}\) Set \(\iota(m) = [m, 0]\text{.}\)
Given
\(\varphi \colon M \to A\text{,}\) define
\(\bar\varphi[m_1, m_2] := \varphi(m_1) - \varphi(m_2)\text{.}\) This is well defined. Indeed, applying
\(\varphi\) to
\(m_1 + n_2 + k = m_2 + n_1 + k\) and cancelling
\(\varphi(k)\) in the group
\(A\) gives
\(\varphi(m_1) - \varphi(m_2) = \varphi(n_1) - \varphi(n_2)\text{.}\) It is a homomorphism with
\(\bar\varphi \circ \iota = \varphi\text{.}\) It is unique, because
\([m_1, m_2] = \iota(m_1) - \iota(m_2)\) shows that
\(\iota(M)\) generates
\(M^{\mathrm{gp}}\text{.}\)