  The production of $\psi(2S)$ mesons in proton-lead collisions at a
centre-of-mass energy per nucleon pair of $\sqrt{s_{NN}}=8.16$ TeV is studied
with the LHCb detector using data corresponding to an integrated luminosity of
34 nb$^{-1}$. The prompt and nonprompt $\psi(2S)$ production cross-sections and
the ratio of the $\psi(2S)$ to $J/\psi$ cross-section are measured as a
function of the meson transverse momentum and rapidity in the nucleon-nucleon
centre-of-mass frame, together with forward-to-backward ratios and nuclear
modification factors. The production of prompt $\psi(2S)$ is observed to be
more suppressed compared to $pp$ collisions than the prompt $J/\psi$
production, while the nonprompt productions have similar suppression factors.
