Reference request: conditions for the kernel of a linear map from $\mathbb{Z}_m^n \to \mathbb{Z}_m^k$ to be free

Let $ \mathbb{Z}_m = \mathbb{Z}/m\mathbb{Z}$ . Let $ A$ be an $ k \times n$ matrix. Let $ f: \mathbb{Z}_m^n \to \mathbb{Z}_m^k$ be a linear map defined by $ f(x) = Ax$ , $ x \in \mathbb{Z}_m^n$ . Are there some references about the condition of $ \ker(f)$ to be a free $ \mathbb{Z}_m$ -module?

For example, the kernel of the map $ f: \mathbb{Z}_4 \to \mathbb{Z}_4$ given by $ f(x) = 2x$ is $ \ker(f) = \{0, 2\}$ . Therefore $ \ker(f)$ is not free.

Let $ f: \mathbb{Z}_m^4 \to \mathbb{Z}_m^2$ be a linear map given by $ f(x) = (2x_1-x_3-x_4, x_2-x_3-x_4)^T$ . Then $ \ker(f) = \mathbb{Z}_m^2$ . In this case, $ \ker(f)$ is free. Thank you very much.