As corrosion is a phenomenon of oxidation of iron considering the oxidation potentials of all the elements is essential. Element with higher oxidation potential than Fe will oxidise faster than iron preventing corrosion in iron.
Oxidation potential of Fe = 0.44 V
Oxidation potential of A = 2.37 V
Oxidation potential of B = 0.14 V
As A has higher oxidation potential than iron, it can be used for coating the surface of iron.