Measurements of cosmic-ray proton and helium spectra with the PAMELA calorimeter