You should understand the concept that ions occur because they want to achieve stability. Among the elements in the periodic table, only Group 8 or the noble gases are stable. Hence, other elements must gain or lose electrons so that they can achieve the same configuration of the nearest noble gas to them. For potassium, the nearest one is Argon.