  \item[Background] Ground-state spins and magnetic moments are sensitive to
the nuclear wave function, thus they are powerful probes to study the nuclear
structure of isotopes far from stability. \item[Purpose] Extend our knowledge
about the evolution of the $1/2^+$ and $3/2^+$ states for K isotopes beyond the
$N = 28$ shell gap. \item[Method] High-resolution collinear laser spectroscopy
on bunched atomic beams. \item[Results] From measured hyperfine structure
spectra of K isotopes, nuclear spins and magnetic moments of the ground states
were obtained for isotopes from $N = 19$ up to $N = 32$. In order to draw
conclusions about the composition of the wave functions and the occupation of
the levels, the experimental data were compared to shell-model calculations
using SDPF-NR and SDPF-U effective interactions. In addition, a detailed
discussion about the evolution of the gap between proton $1d_{3/2}$ and
$2s_{1/2}$ in the shell model and {\it{ab initio}} framework is also presented.
\item[Conclusions] The dominant component of the wave function for the odd-$A$
isotopes up to $^{45}$K is a $\pi 1d_{3/2}^{-1}$ hole. For $^{47,49}$K, the
main component originates from a $\pi 2s_{1/2}^{-1}$ hole configuration and it
inverts back to the $\pi 1d_{3/2}^{-1}$ in $^{51}$K. For all even-$A$ isotopes,
the dominant configuration arises from a $\pi 1d_{3/2}^{-1}$ hole coupled to a
neutron in the $\nu 1f_{7/2}$ or $\nu 2p_{3/2}$ orbitals. Only for $^{48}$K, a
significant amount of mixing with $\pi 2s_{1/2}^{-1} \otimes \nu (pf)$ is
observed leading to a $I^{\pi}=1^{-}$ ground state. For $^{50}$K, the
ground-state spin-parity is $0^-$ with leading configuration $\pi 1d_{3/2}^{-1}
\otimes \nu 2p_{3/2}^{-1}$.
