The correct option is B Ca and Mg
Hardness of water is due to the presence of bicarbonates, chlorides and sulphates of Ca and Mg on it. These Ca2+ and Mg2+ ions react with the anions of fatty acids present in soaps to from curdy white precipitates. As a result, hard water does not produce lather with soap immediately.