Mr. Geek is a greedy seller. He has a stock of N laptops which comprises of both useful and useless laptops. Now, he wants to organize a sale to clear his stock of useless laptops. The prices of N laptops are Ai each consisting of positive and negative integers (-ve denoting useless laptops). In a day, he can sell atmost M laptops. Mr. Geek being a greedy seller want to earn maximum profit out of this sale. So, help him maximizing his profit by selling useless laptops.
The first line of input contains number of testcases T. For each testcase, there will be two lines of input. Th first line contains two integers N and M. The second line contains prices of N laptops.
The maximum profit Mr. Geek can earn in a single day.
1 <= T <= 30
1 <= N ≤ 105
1 <= M <= 105
-1012 <= Ai <= 1012
-6 0 35 4
-1 -2 -3 -4 5
Geek sells the laptops with price -6 and earns Rs. 6 as profit.
Geek sells the laptops with price -2, -3 and -4 and earns Rs. 9 as profit.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.