Potassium has one electron in its outer shell, and Sulfur has two. When forming an ionic compound with one atom of sulfur, two potassium atoms are used. Each potassium atom donates its outermost electron to the sulfur atom, forming ions with a 1+ charge, due to the loss of an electron. When sulfur receives these two electrons, it is ionised itself, becoming an ion with a 2- charge. The difference in charge between the two 1+ potassium ions and the 2- sulfur ion allows electrostatic attraction between the sulfur ions and potassium ions. This is an ionic bond and is the basis of the ionic compound formed, as the differently charged ions are held together by their opposite charges.