I think that the m5's production began in 2000, not 99, so thats the earliest model. correct me if im wrong.
i would also say m5, it'll be maybe 5k more, but you would soon have gotused to the 540i acceleration and overall performance, and wished you had gotten the m.