Dear student,
a) Metal M which is in the middle of reactivity series is first converted to their oxides from carbonates and sulfides by roasting and calcination then they are converted to metals by carbon or by the displacement reaction.
b) Metal N which is high in the reactivity series is obtained by electrolysis
Regards