Testing the universal stellar IMF on the metallicity distribution in the bulges of the Milky Way and M31