Measurements of long-range azimuthal anisotropies and associated Fourier coefficients for pp collisions at root s=5.02 and 13 TeV and p plus Pb collisions at root(NN)-N-s=5.02 TeV with the ATLAS detector