Dear Student,
Oxidation number is the total number of electrons that an atom either gains or loses in order to form a chemical bond with another atom. It is also called Oxidation State.
Potassium is an alkali metal. It can lose only one electron.
Its oxidation state can be 0 (in metallic form) and +1 (in its compounds)
In KO2, potassium combines with superoxide ion (O2-).
Oxidation state of K is +1, of O is -1/2.
Regards