Storing Food Safely


Guide E-118

Revised by Nancy Flores and Cindy Schlenker Davies

College of Agricultural, Consumer and Environmental Sciences, New Mexico State University


Respectively, Extension Food Technology Specialist, Department of Extension Family and Consumer Sciences; and County Program Director/Extension Home Economist, Bernalillo County Extension Office, New Mexico State University. (Print Friendly PDF)

How many times have you wondered if you’ve kept food too long and asked, “Is it still all right to eat?” To help you decide whether to keep it or throw it out, here are some simple guidelines and a food storage timetable.

Photograph of food in a pantry.

© Darryl Brooks | Dreamstime.com

Basic Food Storage Rules

  • The first rule in handling food is to keep it clean. Before preparing food for storage, wash your hands well and make sure utensils are absolutely clean.
  • When shopping, choose cans that are not dented on the seam or rim. In your home, quickly dispose of foods in leaking, bulging, or rusting cans.
  • Keep food either hot (above 140°F) or cold (below 40°F). The “danger zone” (45 to 135°F) provides ideal conditions for the growth of common bacteria that can cause spoilage or even food-related illnesses. Never leave food in this danger zone for more than two hours.
  • Most importantly, smell—but don’t taste—any food you suspect is spoiled. If in doubt, throw it out!

Canned Foods

In general, most canned foods have a very long “health life” and when stored properly are safe to eat for many years. A product’s practical shelf life, however, is tied to proper storage. Although canned foods may be perfectly safe to eat, they may gradually start losing nutrients or flavor, so as a general rule use them within a year. To keep canned foods at their best quality:

  • Store in clean, dry, cool cabinets away from the stove, the refrigerator’s exhaust, or other sources of heat.
  • Don’t store in cupboards where pipes are located. Leaks can damage food containers.
  • Keep in a cool, dark place because prolonged light can affect food color, making it look less appetizing while still safe to eat.
  • Always store metal cans off the floor, especially bare concrete. Moisture can wick up the cans and encourage rusting.

Photograph of jars of pickles on a shelf.

© Marian Mocanu | Dreamstime.com

Check the Label

Product freshness dating on some products can help you decide how long to store them. The “sell by” or “pull” date displayed on dairy products and fresh bakery products is generally the last date the product should be sold, allowing you a reasonable length of time to use the food at home.

The “best if used by (or before)” date used on items with longer shelf lives, such as canned foods, frozen foods, cereals, and fried snack foods, indicates the approximate date when the product quality and flavor will begin to decline. This is not a purchase or a safety date.

The “use by” date found on refrigerated dough products, packaged yeast, and eggs tells you the last day an item should be used before it is likely to lose flavor or quality. This date is determined by the manufacturer of the product. Do not buy or use baby formula or baby food after its “use by” date.

Foods That Need Special Care

Take extra precautions with foods that are especially susceptible to bacterial growth—poultry, fish and shellfish, meat, dairy products, puddings, stuffing, and creamed mixtures.

Cover leftover cooked meats and poultry tightly after use and store them in the refrigerator immediately. Use within two days.

Avoid using cracked eggs. If you must use them, make sure they are cooked thoroughly to kill any bacteria that may be in the egg. Do not cool cooked eggs in water on the counter; cool them in cold running water, then refrigerate or use immediately.

For ease of preparation and food safety considerations, cook dressing (stuffing) separately from the chicken or turkey. However, if you decide to stuff poultry, never stuff it the night before you roast it. When refrigerating leftover poultry and stuffing, remove the stuffing from the bird and store in separate containers.

Cook meat and poultry all the way through. Do not cook partially to finish later.

Photograph of frozen vegetables in a container.

© Arturs Budkevics | Dreamstime.com

Refrigerator and Food Storage

Set your refrigerator between 34 and 40°F and use a thermometer placed in the refrigerator to alert you to temperature fluctuations. Don’t overload the refrigerator since air must circulate freely to cool all foods evenly. Clean the refrigerator regularly to remove spoiled foods so that bacteria can’t be passed to other foods. Store food in foil, plastic wrap or bags, or airtight containers to keep food from drying out.

The freezer should be set at 0°F or lower, and a thermometer should be used to monitor freezer temperature, which should not rise above 5°F. Check the thermostat for the proper setting.

To package items for the freezer, especially meat and poultry, remove the product from its original container and rewrap using heavy-duty foil, moisture- and vapor-proof paper, plastic freezer wraps, or freezer containers. Foil may develop holes when folded, causing freezer burn. If necessary, use special freezer tape to ensure airtightness.

Before freezing, label all freezer foods with the date packed, type of food, and weight or number of servings before freezing.

Partially thawed food can be refrozen safely as long as it still has ice crystals and has been held no longer than a day at refrigerator temperatures. Refreezing, however, may cause a loss of quality, so it is best to cook the food and then refreeze it. Combination dishes (pies, stews, and casseroles) that have been thawed should not be refrozen.

Pantry or Dry Storage

Key points to remember for pantry or dry storage locations are to keep the areas dry, cool, and dark, as well as orderly, clean, and free from insects and rodents. The storage temperature should be kept at about 50°F to maintain food quality, although 60 to 70°F is acceptable. Keep foods in the coolest cabinets in the kitchen, not near the oven, stove, or refrigerator exhaust.

Do not store foods under the kitchen sink or next to household products. Good housekeeping is also a must. Be sure to clean out storage areas periodically and remove crumbs and other food particles that can collect on shelves, in corners, and in cracks. Use metal, glass, and plastic containers with tight-fitting lids to keep out moisture, air, and insects. And remember that using a first-in, first-out inventory system will ensure you use the oldest food items first.

Maintaining Freshness and Quality

To preserve the freshness and quality of food, follow these general principles:

  • Buy foods in reasonable quantities. Excess food may be wasted through spoilage.
  • Select sound packages of food. Avoid items in torn, dented, or damaged packages.
  • Use a first-in, first-out system of rotation and use foods in their order of purchase. Mark foods with purchase date or use label dates.
  • Take time to reseal packages for things like cookies, biscuits, and cereals carefully after use.

Food Storage Chart

Storage times listed in the following table are intended to be useful guidelines, not hard and fast rules. Some foods may deteriorate more quickly and some may last longer than the times suggested. The times will vary depending on growing conditions, harvesting techniques, manufacturing processes, transportation and distribution conditions, nature of the food, and storage temperatures. Remember to buy foods in reasonable quantities and rotate the products in your pantry, refrigerator, and freezer. Trust your own common sense. As a helpful reminder, store this guide in your kitchen or pantry.

Food Storage Timetable

Food

Refrigerator

Pantry

Freezer

Special handling

Breads/cereals/grains: In general, keep cool and dry. For maximum storage time once opened, store in airtight containers. Refrigeration may increase shelf life for some items.

Bread, rolls
(store bought)

5–7 days

3–5 days

2–3 months

Homemade breads may have a shorter shelf life due to lack of preservatives.

Biscuit, muffin mixes

9 months

Cereals

Cereals should be stored at room temperature in tightly closed containers to keep out moisture and insects.

Ready-to-eat

(unopened)

6–12 months

(opened)

2–3 months

Ready-to-cook oatmeal, etc.

12 months

Cornmeal

12–18 months

6–12 months

Keep tightly closed. Refrigeration may prolong shelf life.

Flour

Whole wheat flour can be stored in the refrigerator to slow rancidity of the natural oils.

White

6–8 months

Whole wheat

6–8 months

Yeast (dry)

Expiration date on package

Keep dry and cool.

Grits

12 months

Pancake mixes

6–9 months

Pasta

1–2 years

Rice

White

2 years

Brown

18 months

12 months

Mixes

6 months

Refrigerated biscuit roll, pastry and cookie dough

Expiration date on label

Tortillas

Storage times may vary depending on ingredients. Best if refrigerated once opened. Can be frozen.

Corn, flour

2 weeks

1–2 weeks

2–3 months

Dairy products: Store in coldest part of refrigerator (40°F), never in door.

Butter

2–3 weeks

6–9 months

Wrap or cover tightly. Hold only a 2-day supply in keeper.

Buttermilk

10–14 days

Cover tightly. Flavor not affected if buttermilk separates.

Cheese

Keep all cheese tightly packaged in moisture-proof wrap. Do not eat moldy cheese.

Cottage

10–15 days

Cream, Neufchâtel

4 weeks

Hard and wax coated

Hard cheese can be frozen but becomes crumbly. Better if grated.

Cheddar, Edam, Gouda, Swiss, brick, etc.

(unopened)

3–6 months

6 months

(opened)

2 months

Parmesan, Romano

Refrigerate after opening for prolonged storage. If cheese picks up moisture, mold may develop.

(unopened)

10 months

(opened)

2–4 months

Ricotta

5 days

Refrigerate after opening. Close or wrap tightly.

Process cheese products

3–4 weeks

4 months

Cream

Cover tightly. Don’t return leftover cream to original container. This may spread bacteria to remaining cream. Frozen cream may not whip. Use for cooking.

Half and half, light, heavy

7–10 days

2 months

(ultra pasteurized, unopened)

21–30 days

Sour

2 weeks

Dips (store bought)

2 weeks

Ice cream, ice milk, sherbet

1–2 months

Milk

Keep tightly covered. Don’t return leftover milk to original container. This may spread bacteria to remaining milk. Frozen milk may undergo some quality change.

Fresh pasteurized and reconstituted nonfat dry milk

1 week (or a few days after sell by date)

1 month

Evaporated or condensed

(unopened)

12 months

Invert can every 2 months. Cover tightly.

(opened)

1 week

Nonfat dry, not reconstituted

(unopened)

12–18 months

12 months

Refrigeration may prolong quality.

(open)

6 months

Almond milk*

7–10 days

Shake well before each use.

Rice milk**

7–10 days

Until open

Coconut milk***

10 days

Cover tightly.

Whipped topping

In aerosol can

3 months

From prepared mix

3 days

Yogurt

10–14 days

Check date on package.

Frozen

2 months

Note: Thaw all frozen dairy products in refrigerator. Some products may lose emulsion and separate, but are still adequate for cooking.

Eggs

Fresh

Store eggs in original carton in coldest part of refrigerator. Uncooked whites can be frozen as they are. To freeze uncooked yolks or whole eggs, add 1/8 teaspoon salt or 1 1/2 teaspoons corn syrup per 1/4 cup (4 yolks or 2 whole eggs). Thaw in refrigerator.

In shell

3–4 weeks

No

Whites

3 days

12 months

Yolks (unbroken and covered with water)

2 days

12 months

Hard cooked

1 week

Deviled

2–3 days

Leftover egg dishes

3–4 days

Fish and shellfish: Refrigerator storage times are for optimal temperature of 32–38°F. Higher temperatures may decrease safe storage times.

Fish

Fatty fish

mackerel, trout, salmon, etc.

1–2 days

2–3 months

For refrigerator, keep wrapped in original wrap. Store in coldest part of refrigerator (32–38°F). Package for freezer in moisture- and vapor-proof wrap.

Lean fish

cod, flounder, etc.

1–2 days

6 months

Keep solidly frozen at 0°F. Thaw in refrigerator.

Breaded, frozen

3 months

Shellfish

Refrigerate live clams, scallops, and oysters in container covered with clean, damp cloth—not airtight. Shells will gape naturally, but will close when tapped if alive. If not alive, discard.

Clams

shucked

1 day

3 months

in shell

2 days

Crab

in shell

2 days

meat (cooked)

3–5 days

10 months

Crawfish

in shell

6 months

tail meat (cooked)

3–5 days

6 months

Lobster

in shell (live)

2 days

tail meat (cooked)

4–5 days

6 months

Oysters (shucked)

1 day

4 months

To freeze any uncooked shellfish, pack in moisture- and vapor-proof container. Freeze shucked product in its own “liquor” (liquid) to which water has been added to cover meat.

Shrimp (uncooked)

1–2 days

12 months

Remove heads and freeze shrimp tails in shell. Freeze in water in an airtight container of appropriate size for one meal.

Cooked fish or shellfish

2–3 days

3 months

Canned fish or shellfish

(unopened)

12 months

(opened)

1 day

Fruit

Fresh

Do not wash fruit before storing—moisture encourages spoilage—but do wash before eating. Store in crisper or in moisture-resistant bags or wraps. Wrap cut fruits to prevent vitamin loss.

Apples

1 month

Apricots, avocados, melons, nectarines, peaches, pears

5 days

Bananas

2–3 days

Berries, cherries

3 days

Citrus fruit

2 weeks

Grapes, plums

5 days

Pineapple, fresh

2 days

Canned (all kinds
and juices)

Keep tightly covered. Transfer canned fruit to glass or plastic container after opening.

(unopened)

12 months

(opened)

1 week

Juices

Keep tightly covered once open to prevent vitamin loss. Transfer canned juice to glass or plastic container after opening.

Fresh

6 days

Canned (after opening)

6 days

Frozen

(concentrated)

12 months

(reconstituted)

6 days

Frozen

(home frozen or purchased frozen)

12 months

Freeze in moisture- and vapor-proof container.

Dried

6 months

Keep cool in airtight container. If foods gain moisture, they may become unsafe and allow bacterial growth. Best if refrigerated after opening.

Meats: Beef, pork, lamb, veal, and game.

*Fresh, uncooked

Store in colder part of refrigerator (36–40°F). Freeze immediately if not planning to use in a day or two. Wrap in moisture- and vapor-proof wrap for freezing. Label with date and freeze rapidly at 0°F. Freezer storage times for veal may be less. Pork is best if used within 6 months after freezing. Actual storage time of meat depends on the freshness of meat when purchased.

*Vacuum-packed fresh meats have a recommended storage time of
2 weeks in the refrigerator.

Chops

2–4 days

6–12 months

Ground

1–2 days

2–3 months

Roast

2–4 days

6–12 months

Sausage

1–2 days

1–2 months

Steaks

2–4 days

6–9 months

Stew meat

1–2 days

2–3 months

Variety meats

1 day

1–2 months

Casseroles, TV dinners, stews

2–3 months

Cooked meats (including leftovers)

Cooked meat and meat dishes

1–2 days

2–3 months

Gravy, broths

1–2 days

1–2 months

Cured and smoked meats (including
lunch meats)

Keep wrapped. Store in coldest part of refrigerator or in meat keeper. Freezing cured or smoked meats is generally not recommended because salty meats will rapidly turn rancid and lunch meats and hotdogs will weep. Freezing is possible, however, so limited freezer storage times are given. If meats are vacuum packaged, check manufacturer’s date.

Bacon

5–7 days

1 month

Ham (fully cooked)

whole

5–7 days

1–2 months

slices

3–4 days

canned (unopened)

6–9 months

Do not freeze canned hams.

canned (shelf stable, unopened)

2 years

Refrigerate after opening.

country style (unsliced)

12 months

Refrigerate once sliced. Maximum refrigerator storage time is 2–3 months.

(cooked, sliced)

7 days

1 month

Hotdogs

(unopened)

2 weeks**

1–2 months

(opened)

1 week

Lunch meats

(unopened)

2 weeks**

1–2 months

(opened)

3–5 days

Sausage

smoked links

7 days

1 month

Freezing alters sausage flavor. Leave frozen no more than 1 month.

**Unopened lunch meats and hotdogs should not be kept more than 1 week after sell by date.

dry and semi-dry (like salami)

2–3 weeks

Game birds

2 days

6–12 months

Venison

3–5 days

6–12 months

Poultry

Chicken or turkey

Store in coldest part of refrigerator. Do not let raw juices drip onto other foods For freezing, use moisture- and vapor- proof wrap or container.

Fresh

whole

2–3 days

1 month

pieces

2–3 days

6–9 months

giblets

1–2 days

3–4 months

Cooked

leftover pieces

1–2 days

4–6 months

covered with broth, gravy

1–2 days

6 months

Canned

(unopened)

12 months

(opened)

1 day

Casseroles, TV dinners

3 months

Duck, goose

2 days

6 months

Staples

Baking powder, soda

8–12 months

Keep dry and covered.

Bouillon cubes, granules

12 months

Keep dry and covered.

Catsup, chili sauce, barbecue sauce

Refrigerate after opening for longer storage time. Will keep for several months.

(unopened)

12 months

Chocolate

Keep cool.

Pre-melted

12 months

Semi-sweet

2 years

Unsweetened

18 months

Chocolate syrup

(unopened)

2 years

(opened)

6 months

Cover tightly and refrigerate.

Cocoa mixes

8 months

Cover tightly.

Coffee

Coffee may remain fresher if refrigerated after opening. Can also be frozen.

Cans

(unopened)

2 years

(opened)

4–6 weeks

(whole bean)

2 months

2 weeks

6 months

Instant

(unopened)

1–2 years

(opened)

2 weeks

Coffee creamers, nondairy

Keep tightly closed to keep
out moisture.

(unopened)

9 months

(opened)

6 months

Cornstarch

18 months

Keep tightly covered

Gelatin (all types)

18 months

Honey

12 months

Cover tightly. If it crystallizes, warm the jar in pan of hot water or heat on low in microwave.

Jams, jellies

12 months

Cover tightly; refrigerate after opening to prolong storage.

Margarine

4–6 months

Marshmallows

2–3 months

Keep in airtight container.

Cream

2–3 months

Cover tightly. Refrigerate
after opening.

Mayonnaise

Refrigerate after opening.

(unopened)

2–3 months

(opened)

3 months

Molasses

Refrigerate to extend storage life.

(unopened)

12 months

(opened)

6 months

Mustard, prepared yellow

Refrigerate for best storage.

(unopened)

2 years

(opened)

6–8 months

Oils

Store in cool place away from heat source to prevent deterioration.

(unopened)

18 months

(opened)

6–8 months

Pectin

Look for expiration date.

Liquid

18 months

Recap and refrigerate.

Dry

3 years

Peanut butter

Refrigeration prolongs storage time and helps prevent rancidity.

(unopened)

6–9 months

(opened)

2–3 months

Salad dressing

Bottled (unopened)

10–12 months

Bottled (opened)

3 months

Made from mix

2 weeks

Shortening

12 months

Store away from heat source to prevent rancidity.

Spices and herbs

Store in airtight containers in dry place away from heat or light. Replace if aroma fades. May be refrigerated or frozen for longer storage.

Whole spices

12 months

Ground spices

6 months

Herbs

6 months

Sugar

For best storage, keep in
airtight container.

Brown

4 months

Confectioner’s

18 months

Granulated

2 years

Sweetener, artificial

2 years

Tea

Keep in airtight containers.

Bags

18 months

Instant

3 years

Loose

2 years

Vanilla

Keep tightly closed; volatile
oils escape.

(unopened)

2 years

(opened)

12 months

Other extracts (opened)

12 months

Vinegar

Keep tightly closed. Distilled vinegar lasts longer than cider vinegar. Vinegar in glass containers has a longer storage time. If a cloudy mass develops in opened vinegar, do not use.

(unopened)

2 years

(opened)

12 months

Vegetables: In general, keep in crisper or moisture-proof wrapping.

Fresh

Artichokes

2–3 days

Refrigerate in plastic. Wrap base of stalks with damp cloth or paper towel.

Asparagus

2–3 days

8 months

Refrigerate in plastic. Wrap base of stalks with damp cloth or paper towel.

Beans

dried

12 months

green or waxed

1–2 days

8 months

Do not wash green beans until just before use.

lima (unshelled)

3–5 days

Beets

1–2 weeks

Remove leafy tops. Keep in crisper.

Broccoli

5 days

Brussels sprouts

5 days

Cabbage

1 week

Carrots

5 days

8 months

Celery

1 week

Celery may keep longer if wrapped with a moist towel.

Corn (in husks)

1–2 days

Cucumbers

1 week

Eggplant

2–3 days

Garlic

5–8 months

Greens, spinach, leafy greens, etc.

3–4 days

Keep in cool, dry, ventilated area. Rinse and drain greens before refrigerating. Do not allow to freeze.

Lettuce, iceberg

5–7 days

vacuum packed (unopened)

2–3 weeks

Mushrooms

1–2 days

Do not wash mushrooms before refrigerating. Do not store in airtight container.

Onions

Store at room temperature in cool, ventilated area.

dry

2–4 weeks

Keep dry.

green

5 days

Keep refrigerated in plastic bag.

Parsley

2–4 weeks

Store with stems in water and covered plastic wrap.

Peas (unshelled)

3–5 days

1 week

Peppers

chile

7–10 days

12 months

Keep chile peppers refrigerated in paper bag.

bell

3–4 days

6 months

Freeze for extended use.

Potatoes

Keep fresh potatoes dry and away from sun. For longer storage, keep at 50–60°F. Warmer temperatures encourage sprouting. Don’t refrigerate fresh potatoes.

white, fresh

1 week

sweet, fresh

2–3 weeks

white, instant (unopened)

6–12 months

Radishes

1–2 weeks

Rhubarb

2 weeks

Rutabagas

2 weeks

1 week

Squash

summer varieties

2–4 days

Summer varieties of squash include zucchini and
yellow crookneck.

winter varieties

6 months

Winter or hard-shelled squash include pumpkin, acorn, spaghetti, and butternut squash.

Tomatoes, ripe

2–3 days

Turnips

2 weeks

Do not refrigerate until ripe.

Canned

All kinds

12 months

Dried

Keep all dried vegetables cool and dry in airtight container. Refrigerate for up to 12 months. If moisture is present, foods may become unsafe because moisture allows bacterial growth.

Frozen

Commercially frozen

8 months

Home frozen

12 months

Miscellaneous: Snacks, condiments, mixes, prepared foods, etc.

Baby food, canned

(unopened)

12 months

(opened)

2–3 days

Do not serve directly out of
the jar.

Cakes, store bought

1–2 days

If cake contains butter, cream, whipped cream, or custard frosting or filling, refrigerate.

Angel food

2 months

Chiffon sponge

2 months

Cheese

2–3 months

Chocolate

4 months

Fruitcake

12 months

Yellow pound

6 months

Frosted

8–12 months

Home frozen

3 months

Cake, cookie mixes

12 months

Canned goods

(miscellaneous, unopened)

12 months

Cookies

(store bought, unopened)

4 months

(homemade)

2–3 weeks

Crackers

3 months

Metered calorie products

Instant Breakfast, Boost, etc.

6 months

Keep in can, closed jars, or in original packets.

Nuts

In shell (unopened)

4 months

Freeze for longer life.

Nut meats, packaged (unopened)

6 months

3 months

Party nuts

2 weeks

(salted)

6–8 months

(unsalted)

9–12 months

Pickles, olives

Refrigerate once opened for 2–3 months.

(canned, unopened)

1–3 months

Pies and pastries

2–3 days

Those with whipped cream, custard, or chiffon fillings should be refrigerated.

Fruit

baked

1–2 months

unbaked

8 months

Popcorn (unpopped)

2 years

Store in airtight container.

Pudding mixes

12 months

Sauces, condiments, etc. (store bought)

Hot sauce, Worcestershire, etc.

2 years

Salsa

Fresh homemade salsa has a shorter refrigerator storage time depending upon ingredients (4–7 days). Homemade canned products have a shelf life of up to 12 months, unopened, if adequately processed.

(unopened)

12–18 months

(opened)

1–2 months

*Blue Diamond Growers. 2019. Frequently asked questions. Retrieved from https://www.bluediamond.com/faqs

**Pacific Foods of Oregon. 2019. Ask away. We’re here to help. Retrieved from https://www.pacificfoods.com/faqs/

***Vita Coco. 2019. Frequently asked questions. Retrieved from https://www.vitacoco.com/faq?products=coconutmilk

For Further Reading

E-307: Home Canning of Vegetables
https://aces.nmsu.edu/pubs/_e/E307/welcome.html

E-320: Freezing Vegetables
https://aces.nmsu.edu/pubs/_e/E320/welcome.html

E-508: Keeping Food Safe
https://aces.nmsu.edu/pubs/_e/E508/welcome.html


Photo of Nancy Flores.

Nancy Flores is the Extension Food Technology Specialist in the Department of Extension Family and Consumer Sciences at NMSU. She earned her B.S. at NMSU, M.S. at the University of Missouri, and Ph.D. at Kansas State. Her Extension activities focus on food safety, food processing, and food technology.




Photo of Cindy Schlenker Davies.

Cindy Schlenker Davies is the County Program Director and Extension Home Economist at NMSU’s Bernalillo County Extension Office. She earned her B.S. at Eastern New Mexico University and her M.A. at NMSU. Her Extension and public outreach work focuses on food processing and preservation and food safety.


To find more resources for your business, home, or family, visit the College of Agricultural, Consumer and Environmental Sciences on the World Wide Web at aces.nmsu.edu/pubs.

Contents of publications may be freely reproduced, with an appropriate citation, for educational purposes. All other rights reserved. For permission to use publications for other purposes, contact pubs@nmsu.edu or the authors listed on the publication.

New Mexico State University is an equal opportunity/affirmative action employer and educator. NMSU and the U.S. Department of Agriculture cooperating.

Revised February 2020 Las Cruces, NM