You are given integer numbers. If you compute all the sums of any two of those numbers, and you sort them all, which is the -th of those sums?
For instance, if and you are given the numbers 6, 6, and 4, you can make three sums: , , and . Therefore, the first of those sums is 10, the second is 10, and the third is 12.
Input consists of several cases, each with and , followed by the numbers, all between 1 and . Assume and .
For every case, print the -th sum of all the pairs of numbers.
Author: Salvador Roura
Generation: 2026-01-25T10:12:33.233Z
© Jutge.org, 2006–2026.
https://jutge.org