Your solution is correct. Both will end up spending 2M/3 on the food. I got the same answer when I solved this problem using game theory. Since both consumers think that only half of the load of anything that they order (that they wouldn't order when they were eating alone) would fall on them, they wastefully end up spending too much on food and end up with a lower utility.
A similar example is given here:
http://www.investopedia.com/terms/d/diners-dilemma.asp