It’s all cheeseburgers, pizza, and chili-cheese fries until you have a heart attack. That’s usually the point when most people might think twice about the things they’re eating, but sticking to a diet consisting of only fruits and vegetables may be hard. That’s where good, wholesome dietary fiber comes in, and according to a new study, it might just help survivors live longer.

Dietary fiber, which usually come in the forms of fruits, vegetables, whole grains, and legumes, has already been shown to benefit heart health by lowering the risk of heart disease and stroke. Yet, only eight percent of adults are getting the recommended daily servings of whole grains suggested by the U.S. Department of Agriculture (USDA) — only one of the many reasons why heart disease affects one in four Americans, with 720,000 people suffering heart attacks (myocardial infarction) each year, according to the Centers for Disease Control and Prevention (CDC).

Researchers from the Departments of Epidemiology and Nutrition at the Harvard School of Public Health looked at data from both the Nurses’ Health Study and the Health Professional Follow-Up Study, which together involved over 172,000 participants (most women). Over a nine-year period, all of the participants were required to fill out questionnaires about their lifestyles every two years. By the end of it, the researchers found that 2,258 women and 1,840 men had heart attacks. Of them, 682 women and 451 men died.

When comparing that data to the amounts of dietary fiber each participant who suffered a heart attack ate, the researchers found that those who ate the most fiber reduced their risk of death over the nine years by 25 percent. These people also had a 13 percent lower risk of dying from another heart-related cause, such as stroke or heart disease, Medical News Today reported. What’s more, they found that these results held even after accounting for factors like age, medical history, diet, and lifestyle. They also found that fiber-rich cereals were the foods most eaten by long-living survivors (compared to fruits and vegetables).

“The advantage of this study is we can look at not only eating more fiber after a heart attack to reduce risk of dying, but also supply evidence that increasing consumption before to after [a heart attack] lowers mortality,” study author Shanshan Li told Fox News. So what exactly should people be eating?

Cereal fiber, though it obviously includes cereals naturally high in fiber — there’s a difference between naturally high in fiber and enriched — it also includes whole wheat bread, whole wheat pasta, oatmeal, and brown rice, according to the USDA. It’s also important to read labels, as some foods may only have some whole grains added in — such is the case with many products labeled “multi-grain,” “stone-ground,” “100% wheat,” “bran,” and “seven-grain.” Recommended daily values of the heart-healthy nutrient are 38 grams and 25 grams for men and women under 50 years old, respectively. Men and women over 50 should eat 30 grams and 21 grams, respectively, each day.

Source: Li S, Flint A, Pai j, et al. Dietary fiber intake and mortality among survivors of myocardial infarction: prospective cohort study. BMJ. 2014.