Jealous ex...

In my maths lesson today I was talking to my girlfriends about this boy I've recently started texting (we'll call him J). Whilst I was talking to my girlfriends the boy who I used to have a thing with (we'll call him M) kept on looking at me, he then stood up and stormed out of the room. M has done this before when I was talking to some one 'S'... M had a go at me and it annoyed him that I was talking to S, so I stopped... What do I do?! I can't win! I dont find it fair how he can move on but I can't and I'm never allowed to talk to any other boy... Me and M aren't even texting each other no more... HELP!