The mass and hydrogen content of M31