Explanation of the Expulsion of Impurities from Tokamak Plasmas by Neutral-Beam Injection