The Masses of the Milky Way and Andromeda galaxies