Savings account B offers a higher APY because monthly compounding gives a better return than quarterly compounding.
Savings account A: Quarterly compounding: APY = (1+0.02/4)^4 -1 = 2.015%
Savings account B : Monthly compounding: APY = (1+0.02/12)^12 -1 = 2.018%
As we can see, Savings account B with monthly compounding produces a slightly higher APY than A and hence is better than A