For a multiset A (a set whose elements may repeat), define the function f(A) as follows: f(A) is the largest integer x such that every integer from 1 to x can be written as the sum of the elements of some sub-multiset of A, while x+1 cannot be written as such a sum. (A sub-multiset is itself a multiset, so each element may be used only as many times as it appears in A.)
You are given a multiset A with n elements. Choose k of its elements to form a sub-multiset B so that f(B) is as large as possible, and report that maximum value of f(B).
The first line contains an integer t (1≤t≤100), the number of test cases. Each test case consists of two lines. The first line contains two integers n and k (1≤k≤n≤105). The second line contains n integers a1,a2,…,an (1≤ai≤109), separated by single spaces, the elements of A.
The sum of n over all test cases does not exceed 106.
For each test case, print on its own line a single integer: the maximum possible value of f(B).