When the concentration is expressed in molality, it is expressed in moles of solute per kilogram of solvent. Since we are given the mass of the solvent, which is water, we can compute for the moles of solute NaNO3.
0.5 m = x mol NaNO3/0.5 kg water
x = 0.25 mol NaNO3
Since the molar mass of NaNO3 is 85 g/mol, the mass is
0.25 mol * 85 g/mol = 21.25 grams NaNO3 needed