Since potassium is an alkali metal (first column of periodic table), it has one electron in its outer shell. Sulfur, however, has six electrons in its outer shell. In an ionic bond, electrons are donated from one of the consituent ions to another, so that one becomes negatively charged due to an increase in electron number, and the other becomes positively charged, due to a decrease.In this case, it is easier for potassium to give one electron away than to take 7 on board to gain a full and stable outer shell. As sulphur has only 6 electrons on its outer shell, and 8 is the number required for stability, it must bond with 2 potassium ions. These potassium ions have each donated their outer shell electron to bond with sulphur. Since the potassium ions have lost an electron, they become K+ ions. The sulphur ion has gained two electrons, and therefore becomes S2-.