#include <iostream>
#include <queue>
#include <unordered_map>

using namespace std;

int main() {
    int n;
    while (cin >> n) { 
        priority_queue<int,vector<int>,greater<int>> heap;
        unordered_map<int,int> m;
        while(n--){
            int a;
            cin>>a;
            if(m.count(a))continue;
            else{
                heap.push(a);
                m[a]=1;
            }
        }
        int k;
        cin>>k;
        while(k--){
            if(k==0)cout<<heap.top();
            heap.pop();
        }
    }
    return 0;
}