You have four problems to work here.
Mg + 2HCl ==> MgCl2 + H2
mols Mg = grams/molar mass
Convert mols Mg to mol H2.
mols HCl you have. Convert to mols H2.
The SMALLER number of mols will be the correct answer for mols H2 produced.
Do the same for flask B. The flask that produces the more mols H2 will be the one that inflates the balloon more.