import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNextInt()) {
int cnt = sc.nextInt();
for (int i = 0; i < cnt; i++) {
int n = sc.nextInt();
int k = sc.nextInt();
Integer[] arr = new Integer[n];
for (int j = 0; j < n; j++) {
arr[j] = sc.nextInt();
}
Comparator<Integer> cmp = new MyComparator();
Arrays.sort(arr,cmp);
for (int j = 0; j < n; j++) {
k = k - j;
if (k <= 0) {
System.out.println(arr[j]);
break;
}
}
}
}
}
}
class MyComparator implements Comparator<Integer> {
public int compare(Integer o1, Integer o2) {
// 如果o1小于o2,我们就返回正值,如果n1大于n2我们就返回负值,
return o2 - o1;
}
}