A number is twice another number. When the larger is subtracted from 50, the result is 2 more than when the smaller is subtracted from 40. Find the numbers.