Measurement of long-range two-particle azimuthal correlations in Z-boson tagged pp collisions at sqrt(s) = 8 and 13 TeV