First, let's do the electronic distribution of the two ions.
For this, we need the atomic number of both:
K is 19 and O is 8.
K²⁺ loses 2 electrons, so it has 17 electrons.
K²⁺ - 1s² 2s² 2p⁶ 2s² 2p⁵
O⁻ gains 1 electron, so it has 9 electrons.
O⁻ - 1s² 2s² 2p⁵
valence shell
A stable ion must have 8 electrons in the valence shell, just like noble gases. Both ions have 7 electrons in the valence shell, which makes them unstable ions. Therefore, under normal conditions, it is not possible to obtain these ions. Typically, these elements forms this ions:
K⁺ and O²⁻.