A calorie is a calorie, but if you eat calories with high fiber, some will not be absorbed. Calories that are from refined processed foods that are high in simple carbohydrates hit your blood streem quickly, cause a high insulin response, and are more quickly converted to fat stores if you do not use them up right away, and you feel hunger sooner than if you ate complexed carbohydrates and lean protiens that had the same calorie content. If you eat a bad fat, like a hydrogonated oil or a saturated fat, the body sees this as a fat, just like an olive oil and it treats it the same way in processing, but, a hydrogenated oil has effects on your blood lipids that are negative, and olive oil has positive effects, so it does not make any difference if you get 100 calories from bacon grease or from an avacado as far as your weight goes, but it matters for your health.
I have struggled with weight for a lot of years. The best thing to do is to not try to be perfect, and to not let one little slip destroy a whole day. If you ate the M&M's still eat the salad you had planned for dinner, if you just give up on the day and eat fried chicken mashed potatos and gravy for dinner because you already messed up for the day, it will sabatoge your whole outlook.
Eat well, most of the time. Forgive yourself when you don't, and eat well later. I do best when I avoid simple carbohydrates, and if I eat foods that have a lot of bulk and water in them. Furits and veggies are my God send. I can have a slip up if I am getting most of my bulk from foods that look like I just picked them...
Good luck to you!
M.