The SCUBA-2 Cosmology Legacy Survey: the EGS deep field - I. Deep number counts and the redshift distribution of the recovered cosmic infrared background at 450 and 850 μm