Excuse the napkin math, but presuming a common candy bar such as a snickers is 215 calories and walking a mile burns 100 calories and you walk an average of 2.5-3 miles per hour, you will need to walk less than 1 hour to burn the calories off.
I read a stat once. To burn 1 m&m you would have to walk or run the length of a football field
200yd for a regular M&M, you'd have to run down and back (600yd) for a peanut M&M.
You'd have to walk roughly 2.5 miles to burn off a bag of either since there are fewer peanut ones in a bag.