eolymp
bolt
Try our new interface for solving problems
Problems

Subprojects

Subprojects

Time limit 1 second
Memory limit 128 MiB

Ramzi Sarnayeh has founded a new suburban services company named Undetermined Ideas (UI). Since UI is young, Ramzi has not hired employees yet. Therefore he's alone in first few months and must manage everything himself sequentially until he can extend his work. Recently he has acquired some projects from government ministries and has broken all projects to small independent subprojects with different values. We can assume all subprojects can be accomplished in one time unit. Unfortunately, Ramzi has limited available time and being optimistic, he wants to know how much, at best, he can earn by accepting valuable subprojects and rejecting the others.

Input data

The first line contains the number of test cases. Each line is a separate test case that starts with two integers that are Ramzi's available time t and the number of subprojects p~(0 \le t, p \le 1000) respectively. After these two numbers there are p non-negative integers (between 0 and 32767, inclusively) which are values of subprojects.

Output data

For each test case print one line that contains the maximum earning (sum of values) that can be achieved within Ramzi’s available time.

Examples

Input example #1
3
3 5 1 1 1 1 1
4 2 161 5
4 7 8 2 9 17 4 4 10
Output example #1
3
166
44