If you like someone else, it is not really fair for you to be stringing D along, so the best thing to do is probably break up with D, especially since he knows you like M. You can try to date M again, but that might mean you only get to see him once in a while and would mostly just talk on the phone, text, e-mail, etc.