I don't know why you're getting downvoted. A calorie is a calorie in isolation. Eating at a surplus because you don't feel full after eating a bag of M&M's doesn't change that fact.
It certainly helps (in many ways) to e.g. increase protein in leue of sugar, but that you will certainly ly lose weight if calories burned > calories consumed.