Isotonic solutions of the same volume at the same temperature contain the same total number of moles of solute particles.
MA5+MB1=MA3+MB5
Collect the A terms on one side and the B terms on the other:
MA5−3=MB5−1⇒MA2=MB4
MBMA=42=21

Answer: MA:MB=1:2. Check: take MA=1 and MB=2 (any units). First solution: 5+0.5=5.5 mol; second: 3+2.5=5.5 mol. ✓