Elements react with others in such a way to have 8 electrons in their valence shell (the outermost energy level.) Sometimes they form ionic bonds, in which electrone move from one atom to the other; the atoms are then held together by the difference in their charges. In other compounds, electrons are shared, so that both atoms end up with 8 in their outer shells.
In your examples, potassium has one valence electron, and would therefore react with an atom that has 7--again, that magic number of 8 is key. Which one of your listed elements has 7? Bromine. (Krypton is a noble gas; it already has 8, and is very, very NON-reactive.)
Your second question is about oxygen, which has 6 valence electrons, so we are looking for the element with 2--calcium.
potassium will be most reactive with bromine, because all atoms try to gain the pseudo configuration of a noble gas, potassium is trying to get rid of that one electron keeping it away from having a noble gas configuration and bromine is trying to gain 1 more electron to reach 8
Oxygen will be most reactive with calcium, because oxygen is trying to gain 2 electrons while calcium is trying to lose 2
it all has to do with valance electrons