Measurement of prompt ψ(2S) production cross sections in proton–lead and proton–proton collisions at s NN =5.02TeV