The numbers in a sequence 2, 7, 12, 17, 22 increase by fives. The numbers in the sequence 3,10, 17, 24, 31 increase by sevens. The number 17 occurs in both sequences. What is the next number which occurs in both sequences?