The metal M is copper (Cu) which reacts with oxygen when heated in the air to form black coloured copper(ll) oxide. The reaction can be written as:
2Cu+O2→2CuO
Copper is present below hydrogen in the reactivity series of metals. So, it does not react with dilute acids like hydrochloric acid or sulfuric acid.