Image Credit: jolopes/Adobe Stock

Let's face it: It's hard to say no to the occasional doughnut or double cheeseburger. But as it turns out, the foods we eat can have pretty dire consequences for how long we live.

About 45.4 percent of deaths caused by heart disease, stroke or type 2 diabetes — the leading causes of death in the U.S. — are associated with eating either too much or too little of certain foods, revealed a March 2017 study published in the Journal of the American Medical Association (JAMA). Read on to find out which dietary habits have the greatest impact on your longevity.

Want to lose weight or just get healthier? Join MyPlate Calorie Counter and get access to free meal plans, healthy recipes and at-home workouts. You'll also get daily calorie and macro goals for your fitness journey. Sign up today!

1. Too Much Red Meat

High meat intake led to 4.2 percent of diabetes-related deaths in 2012. But it's not all bad. Red meat actually accounted for less than 1 percent of diet-related deaths. And on top of being packed with protein, red meat also provides a variety of nutrients, such as B vitamins, iron and zinc.

Although there's no hard-and-fast rule for how much red meat you should eat, the American Institute for Cancer Research suggests limiting your intake to less than 18 ounces a week. The key thing to remember is that quality matters: Choose lean cuts of grass-fed red meat, avoid meat raised in factory farms and skip processed meats (the dangers of which we'll discuss later in this article).

2. Too Many Solid Fats

Image Credit: Sea Wave/Adobe Stock

A diet high in solid fats caused 2.3 percent of diet-related deaths brought about by cardiometabolic causes — stroke, heart disease and Type 2 diabetes — according to the JAMA study. Solid fats are fats that are solid at room temperature, such as beef fat, butter, shortening, coconut oil and palm oil. They contain more saturated fats and trans fats than oils, according to MyPlate.gov. Because of that, they can raise your bad (LDL) cholesterol and increase your risk for heart disease. Opt instead for heart-healthy oils, such as avocado or olive oil.

3. Too Many Refined Grains

Not eating enough whole grains and eating too many refined grains caused 5.9 percent of the deaths studied.

Whole grains like whole-wheat flour, bulgur, oatmeal and brown rice contain the entire grain kernel. Refined grains like pasta, white rice and white bread have been processed to remove the bran and germ, which gives the grains a finer texture and improved shelf life.

While much of the B vitamins and iron that are stripped during the milling process are added back into refined grains, the fiber is gone for good. MyPlate.gov recommends that adults eat between 5 and 8 ounces of grains every day, depending on their age and sex, and that whole grains make up at least half of all the grains you eat.

Read more: 13 Powerful Grains and Seeds

4. Too Many Sugary Beverages

For people aged 25 to 64, sodas and other sugary beverages were associated with more early deaths than any other dietary factor. Overall, 7.4 percent of deaths were associated with sugary drinks, impacting more men than women.

Drinks high in sugar are associated with tooth decay, metabolic syndrome and obesity, and the Boston Public Health Commission writes that women who drink one or more sugary beverages a day are almost twice as likely to develop diabetes as women who have one or less. According to the U.S. government's dietary guidelines, less than 10 percent of your calories every day should come from added sugars. Try replacing soda and other sweetened drinks with seltzer water, flavored water, tea or fresh vegetable juice.

Read more: The Top 10 Beverages to Avoid

5. Not Enough Fruit

Image Credit: cook_inspire/Adobe Stock

Fruits are rich in many essential nutrients that are often under-consumed, including potassium, vitamin C, folic acid and dietary fiber, according to MyPlate.gov.

Skipping the daily recommended fruit intake accounted for 7.5 percent of the diet-related cardiometabolic deaths studied. MyPlate.gov recommends eating about 1 1/2 to 2 cups of fruit every day.

6. Not Enough Vegetables

It turns out that our parents were right about eating our veggies. Not including enough vegetables caused 7.6 percent of the deaths studied. Like fruits, vegetables are low in fat and calories, and no vegetables have cholesterol. They're packed with important nutrients like potassium, fiber, folic acid, vitamin A and vitamin C, according to MyPlate.gov, which recommends eating about 2 1/2 cups of vegetables a day.

Read more: 10 Tricks to Save Money and Waste Less of Your Fruits and Vegetables

7. Not Enough Seafood

MyPlate.gov recommends that you eat around 5 1/2 ounces of protein a day. Interestingly, the agency specifically suggests eating 8 ounces of cooked fish every week, which makes sense when you take into account that not eating enough seafood caused 7.8 percent of diet-related cardiometabolic deaths.

Fish is loaded with heart-healthy omega-3 fatty acids, which play a crucial role in brain function, reduce inflammation and can lower your risk of heart disease. Aim to eat fish that are high in omega-3s and low in mercury, such as salmon, anchovies, sardines, herring, Pacific Oysters, trout and Atlantic and Pacific mackerel.

Read more: 13 Types of Fish to Avoid Eating

8. Too Much Processed Meat

Eating too much processed meat accounted for 8.2 percent of all the diet-related deaths studied. Processed meats are preserved by smoking, curing, salting or adding preservatives, according to the American Heart Association, and include cold cuts, sausage, bacon and hot dogs.

Alicja Wolk, D.M.SC., professor in the Division of Nutritional Epidemiology at the Institute of Environmental Medicine, tells the association that additives like sodium, nitrates and phosphates in processed meats are the culprits behind consumers' increased risk of heart failure.

9. Not Enough Nuts and Seeds

Image Credit: yvoneisenstein/Adobe Stock

Interestingly, not eating enough nuts and seeds contributed to 8.5 percent of the deaths analyzed. Nuts and seeds are part of the protein food group, and are incredibly nutrient-dense. They contain fiber, magnesium and polyunsaturated fats.

A study published in the medical journal BMC Medicine found that eating about a handful of nuts (or 20 grams) a day can cut your risk of heart disease by 30 percent and your risk of diabetes by nearly 40 percent. But because they're high in calories, try to limit your intake, and use them to replace other protein-rich foods, like meat. The American Heart Association recommends eating four 1 1/2-ounce servings of nuts per week.

Read more: 9 Healthy Nuts That May Help You Live Longer

10. Too Much Sodium

The leading cause of diet-related cardiometabolic death in 2012 was high sodium, a habit that accounted for about 9.5 percent of the 318,656 deaths studied. People over age 65 had the highest proportion of sodium-related deaths.

Sodium causes your body to retain water, and according to the American Heart Association, too much water can put a strain on your heart and blood vessels. The AHA sets the ideal limit at no more than 1,500 milligrams (less than 1 teaspoon of salt) daily. To lower your sodium intake, avoid processed foods, cheeses, packaged snacks and frozen dinners. Reach for fresh foods and use herbs, spices, vinegar or citrus juices to add flavor to your meals.