Solving the intensity problem of surface X-ray diffraction using dynamical theory