Projects#270

Projects

1 second
128 megabytes
Easy (≈1000)

Cəsur founded a new suburban service company called Unresolved Ideas. As he had not yet hired any employees and could not expand his company, he had to work alone for the first few months. Some time ago, he received various projects and divided all the projects into small independent subprojects of different values (i.e., he would only complete some of the projects).

We assume that all subprojects are executed in unit time (1 project is completed in 1 unit of time). As Cəsur has limited time and is optimistic about the future, he wants to know the most he can earn by accepting the more valuable subprojects and ignoring the others.

Input

The first line contains an integer — the number of test cases. Then, for each test case, the data is given on one line. Each test case begins with two integers: the time at Cəsur's disposal and the number of subprojects p~(0 \le t, p \le 1000). Following these two integers are p_i non-negative integers (0\le p_i\le 32767), which are the values of the subprojects.

Output

For each test case, print a single integer on a separate line — the maximum total amount of money (sum of values) that can be earned in the favorable time available to Cəsur.

Examples

Example 1

Loading
Loading