Controlling our appetite is no easy task. Although some of us may claim to have superior self-control, there are a variety of triggers that can result in overeating, including boredom, appetite, and even our DNA. One of the most common factors people blame for their heightened hunger is stress from work. Even children delve into emotional eating when they get stressed.

Researchers from the University of Alabama at Birmingham led a study examining why stress is caused by mental work, meaning the work we do day in, day out at our jobs, results in overeating, and confirmed that exercise can counteract this effect.

“Exercise has the ability to increase available fuel sources in the body that may signal to the brain: ‘Here is the energy source I need, I don’t need to replenish it through food,'" the study’s lead author William H. Neumeier told TIME.

Neumeier and his colleagues recruited 38 college students who were placed into two groups. The first group completed a graduate level entrance exam before spending 15 minutes at rest while the second group completed the same test before doing 15 minutes of high intensity interval training on a treadmill. Following the experiment, participants were given pizza and told to eat as much as they desired.

Participants that rested for 15 minutes after completing the exam consumed, on average, 100 calories more than those who ran on the treadmill. The researchers speculate physical activity curbs appetite due to its effect on ghrelin, a hormone that regulates hunger.

“Perhaps it’s the distraction that buffers the desire for food,” Neumeier added. “I think this will be highly applicable to a number of individuals who perform sedentary tasks that are mentally demanding but not physically demanding.”

So how does all that stress combined with overeating effect people with stressful jobs down the road? Researchers from the Southern Medical University in Guangzhou, China, categorized 138,782 study participants into four groups: those with passive jobs, low stress jobs, high stress jobs, and active jobs. Participants with high stress jobs were 22 percent more likely to suffer a stroke compared to those with low stress jobs.

While the occasional bout of binge eating when life gets you down may not seem all that harmless, evidence suggests controlling overeating is the key to weight loss. Eating less and working out more is the focal point of most weight loss programs. However, we rarely take into account how our emotions can influence both diet and exercise.

According to the Anxiety and Depression Association of America, the number of people who use exercise to manage stress is still relatively low, but it is growing. One of their recent polls showed that 14 percent report using physical activity to cope with their stress while 17 percent reported sleeping and 14 reported watching movies or TV. Among those who exercise, 29 percent walk, 20 percent run, and 11 percent do yoga.

Source: Kristi S, William H, Neumeier W, et al. Exercise Following Mental Work Prevented Overeating. Medicine & Science in Sports & Exercise . 2016.