Get under the hood and reach the screws at the end of the accelerator cable, slowly turn them till the metal cable inside has no slack. Do this while the engine is off. Once done turn the engine on and try to rev the engine by pressing the pedal hard, it should start working. This happens because of cruise control problem, you may have accidently turned it on. BMWs have trouble with stuck accelerator pedals because of them.
For safety reasons do it in an isolated area.