Since ore A gives CO2 and ore B gives SO2.
Therefore, ores are MCO3 and MS.
A can be obtained as:
\(MCO_3\overset{Calcination}\rightarrow MO + CO_2\)
\(MO+C\overset{Reduction}\rightarrow M+CO\)
B can be obtained as:
\(2MS+3O_2\overset{Roasting}\rightarrow2MO+2SO_2\)
\(MO +C\rightarrow M+CO\)