One car went 10 miles farther when traveling at 50 mph than a second car that traveled 2 hours longer at a speed of 40 mph. How long did the first car travel?