import java.util.*;
public class Main {
class Pair {
int current;
int times;
public Pair(int current, int times) {
this.current = current;
this.times = times;
}
}
Comparator<Pair> comparator=new Comparator<Pair>(){
public int compare(Pair n1,Pair n2){
if(n1.times>n2.times)
return 1;
else
return -1;
}};
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
while(nā>0){
int l=sc.nextInt();
int k=sc.nextInt();
int[] arr=new int[l];
for(int i=0;i<l;i++){
arr[i]=sc.nextInt();
}
getfrequent(arr,k);
}
}
public static void getfrequent(int[] arr,int k){
HashMap<Integer,Integer> mp=new HashMap<>();
PriorityQueue<Pair> heap=new PriorityQueue<>();
for(Map.Entry<Integer, Integer> entry : mp.entrySet()){
heap.add(new Pair(entry.getKey(),entry.getValue()));
if(heap.size()>k){
heap.poll();
}
}
while(heap.size()>0){
System.out.print(heap.peek().times);
heap.poll();
}
}
}