Proton momentum spectra in high-energy reactions of 9Be and 12C with quasimonochromatic photons