The average (arithmetic mean) of the 5 positive integers k, m, r, s, and t is 18, and k < m < r < s < t. If t is 40, what is the greatest possible value of the median of the 5 integers?  Choose the correct choice from the following answers:
A) 16 B) 23 C) 19 D) 20 E) 22

Rationale: "we need to find the median which is the third value when the numbers are in increasing order . since k < m < r < s < t , the median would be r . the average of the positive integers is 18 which means that in effect , all numbers are equal to 18 . if the largest number is 40 , it is 22 more than 18 . we need r to be maximum so k and m should be as small as possible to get the average of 16 . since all the numbers are positive integers , k and m can not be less than 1 and 2 respectively . 1 is 17 less than 18 and 2 is 16 less than 18 which means k and m combined are 33 less than the average . 40 is already 22 more than 18 and hence we only have 33 - 22 = 11 extra to distribute between r and s . since s must be greater than r , r can be 18 + 5 = 23 and s can be 18 + 6 = 24 . so r is 23 answer ( b )"
Answer: B