Answer
The grating has $~~513~~$ lines per millimeter.
Work Step by Step
We can write an expression for the angles of the diffraction orders:
$sin~\theta_m = \frac{m~\lambda}{d}$
We can find $d$:
$sin~\theta_2 = \frac{(2)~\lambda}{d}$
$d = \frac{(2)~\lambda}{sin~\theta_2}$
$d = \frac{(2)(620\times 10^{-9}~m)}{sin~39.5^{\circ}}$
$d = 1.95\times 10^{-6}~m$
We can find the number of lines per millimeter:
$N = \frac{1.0\times 10^{-3}~m}{1.95\times 10^{-6}~m}$
$N = 513$
The grating has $~~513~~$ lines per millimeter.