First, stay as calm as possible and save time not trying to get the pedal at the idle position. Immediately start downshifting to use the engine braking to slow the vehicle down, and slowly apply your handbrake if your car is equipped with a manual lever or pedal style one. Be very gentle with applying the handbrake since it only stops the rear axle, and you do not want to initiate a slide or spin out. While gently applying the hand brake and downshifting, you will be able to get your vehicle to a complete stop in a safe manner. Once the vehicle is stopped, the best thing to do is get a tow truck to tow your car to the nearest workshop to inspect what went wrong and what to replace.