public static void main (String Args[]){
		
ArrayList<Integer> list = new ArrayList<Integer>();
		Scanner s = new Scanner(System.in);
		t = s.nextInt();
		Scanner sr;
		while(t>0){
			s.nextInt();
			list.add(s.nextInt());
			sr = new Scanner(s.nextLine());
		
			while(sr.hasNext()){
			list.add(sr.nextInt());
			}
		//	System.out.print(list);
			if(t==0){
		index = s.nextInt();
			}else{
				index = s.nextInt();
			}
		index--;
			value = list.get(index);
			Collections.sort(list);
		//	System.out.print(list);
			answer = Collections.binarySearch(list, value);
			answer++;
			System.out.println(answer);
			list.clear();
			
			t--;
		}
	
	
	
	}