One is a round pill with M over S12 (could look like 512). That is Sumatriptan 100 mg used for treating migraines (NDC 0378-5632).

From DailyMed:

Inactive Ingredients:
- Silicon Dioxide
- Croscarmellose Sodium
- Hypromelloses
- Lactose Monohydrate
- Magnesium Stearate
- Cellulose, Microcrystalline
- Polydextrose
- Polyethylene Glycols
- Povidones
- Sodium Lauryl Sulfate
- Titanium Dioxide
- Triacetin
There is another tablet which is more oblong and has the imprint M512 all on one line. That is Capecitabine 500 mg which is a cancer drug (NDC 0378-2512).
From DailyMed:

Inactive Ingredients:
- Anhydrous Lactose
- Croscarmellose Sodium
- Hypromelloses
- Cellulose, Microcrystalline
- Magnesium Stearate
- Polydextrose
- Polyethylene Glycols
- Titanium Dioxide
- Triacetin