The electron distribution of potassium ion is/kloc-0 1S22S2P2P63P6.
18 electrons are in 4s and 3d (3s and 3p are also in 3d).
The layer here is not the same as the layer in principal quantum number, but the layer here expresses a spatial meaning.
K has no electrons in 3d, and ions have no electrons in 4s.