#include <cstdio>
#include <iostream>
#include <string>
#include <queue>
using namespace std;
int main(){
int n;
while(scanf("%d",&n)!=EOF){
priority_queue<int,vector<int>,greater<int>> myPriorityQueue;
while(n--){
int x;
scanf("%d",&x);
myPriorityQueue.push(x);
}
int order;
scanf("%d",&order);
int answer=-1;
while(!myPriorityQueue.empty() && order>0){
int x=myPriorityQueue.top();
myPriorityQueue.pop();
if(x==answer){
continue;
}
order--;
answer=x;
}
printf("%d\n",answer);
}
return 0;
}

京公网安备 11010502036488号