Atoms with the same number of protons and different numbers of neutrons are called isotopes. The isotopes of an element have different masses because of their different numbers of neutrons.
Potassium has three naturally occuring isotopes. Potassium-39 has 20 neutrons, potassium-40 has 21 neutrons and potassium-41 has 22 neutrons. All potassium atoms have 19 protons, the same as its atomic number. The average mass of an element takes into account the masses of the isotopes and their relative abundance.
Heavier isotopes of elements tend to have an unstable nucleus and undergo radioactive decay. For example, carbon-14 is radioactive and is used to date fossils. Other radioactive isotopes are used to diagnose and treat disease, to generate electrical power, and as tracers because their radiation can be detected.