A quick answer to this would be simply that the mass of the reactants must also be 2 grams, according to the conservation of matter law. But I suspect what is wanted are the specific masses of the hydrogen and nitrogen.
2 grams of NH3 should be converted into moles, by dividing the mass by the molar mass of NH3. 2g/17g/mole = 0.118 moles NH3.
Now we can find the number of moles needed for the H2 and NH3 by looking at the molar ratios of these molecules compared to the ammonia molecule (NH3).
H2/NH3 is (3/2)
Once we know the moles of H2, we can find the moles N2 required:
N2/H2 is (1/3)
Hydrogen is then (3/2)*(0.118 moles NH3) = 0.1764 moles, or 0.3528 grams.
Nitrogen is (1/3)*(0.1764 moles H2) = 0.0588 moles N2, or 1.64772 grams
Add the grams of nitrogen and hydrogen and we get a total of 2 grams, as predicted by the conservation of mass law.