NAJEB - Annie’s 18th Birthday

Today is Annie’s 18th birthday. So Uncle John has given her N boxes of chocolate as a gift. But there is a restriction; she can’t take all the boxes of chocolate. She can take exactly M boxes of chocolate and rest of the boxes will be given her younger brother. ith box contains xi chocolates. Now UncleJohn shuffles all the boxes. Now Annie chooses M boxes blindly. What is the maximum and minimum number of chocolate that she can get?

Input: 

Input starts with an integer T (T≤100) denoting the number of test cases. Each case starts with two space separated integers N and M (1≤N≤1000), (1≤M≤N). Then next N line contains N integers, where ith integer denotes the number of chocolate xi(1≤ xi ≤1000) in the ith box.

Output:

For each case, print the case number, maximum and minimum number of chocolate that Annie can get.

 

Sample:

Input

Output

2
5 2
1 3 4 5 2
5 5
1 4 5 3 2

 

Case 1: 9 3
Case 2: 15 15

 

Authored By: Tanvir Hasan Anick


Added by:Najmuzzaman
Date:2014-10-25
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2014-10-26 04:48:13 Jacob Plachta
Moved to Tutorial.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.