Hi Miles -- It sounds like you have a base-metal (AE) follis of Justinian I, emperor of the Byzantine Empire from 527 to 565AD. The large M refers to the denomination (40 nummi), the NIK refers to the minting location, and the ANNO XII refers to the year made.
The example in our picture comes from Jean Elsen et ses Fils in Brussels, a well-known and highly respected dealer in rare coins. Jean's particular coin sold for 130 euros (about $175 US dollars) in a 2012 auction. This gives and general idea of value, but for old medieval coins like this, each coin stands on its own merits. In worse condition, the value would be less. Here are some very approximate catalog values
average circulated: $180
well preserved: $500
There is a great page on coins of Justinian I at DirtyOldCoins.com. According to this page on Numista, the inscriptions read DN IVSTINI ANVS (justinianus) PP AVI. Importantly, we have a page about the M denomination, and other denominations, at this CoinQuest link [Click Here].
For more understanding of values, consider the four images to the left, labeled (A) through (D). These images show coins of decreasing value. The (A) coin is a $500 coin. It is very crisp and well defined, with zero problems like scratches, stains, nicks, and gouges, and has superb eye appeal. The (B) coin is almost as nice as (A), but not quite. It is a little less defined and the inscriptions are more difficult to read. A coins like (B) would probably sell to a collector for about $300. The (C) coin is heavily worn with many indistinguishable features. It is a $50 coin. Finally, the (D) coin is a fake, worth zero. Take your coin to a knowledgeable collector or professional dealer for an in-person inspection.