On the production of mesons in hydrogen and carbon above 10 GeV