import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException {
		StreamTokenizer re = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		re.nextToken();
         int T = (int)re.nval;
        for(int i = 0;i<T;i++){
            re.nextToken(); int n = (int)re.nval;
            re.nextToken(); int k = (int)re.nval;
            int []array = new int[n];
            for(int z = 0;z<n;z++){
                re.nextToken();int l = (int)re.nval;
                array[z] = l;
            }
            Arrays.sort(array);
            System.out.println(array[k-1]);
        }
    }
}

java的快速读取。