Exercising to lose weight can sometimes yield some disappointing results, but a new study suggests the key is to control how much you eat after a workout.

The study, published last month in the American Journal of Clinical Nutrition, suggests people who fail to lose weight or even gain weight while exercising tend to eat more than compared to when they weren’t hitting the gym.

“Some people eat less when they exercise, so they do lose a lot of weight,” Dr. Tim Church, a professor at the Pennington Biomedical Research Center and one of the authors of the study, told CTV News Channel. “Most people eat more when we exercise and some people eat a lot more.”

“If weight loss is your goal, you’re going to need to cut some calories out of your diet.”

The research team studied 171 overweight men and women who weren’t working out and divided them into three groups: a group that wouldn’t change their lifestyle, a group that worked out for about 150 minutes a week, and a group that worked out about 200 minutes a week.  

The researchers tracked several health indicators including heart rate, overall fitness and energy intake, but the volunteers were allowed to eat whatever they wanted.

The researchers found the sedentary group’s weight largely remained the same, while the two workout groups were mostly disappointed with their results. The researchers found a lot of the people in the workout groups had begun eating slightly more to compensate for the extra lost calories.

“When it comes to weight loss, it starts with the mouth,” said Church. “The feet keep the weight off once you’ve lost it, but if you want to lose weight, you’ve got to eat less.”

Still, Church says there are plenty of other health benefits to working out, even if you don’t lose weight, such as less stress, a stronger heart and better sleep.