#include<iostream>
#include<queue>
#include<unordered_set>
using namespace std;
int main() {
    priority_queue<int, vector<int>, less<int>>q;
    unordered_set<int>data_set;
    int N;
    scanf("%d", &N);
    vector<int>data_list;
    while (N--) {
        int data;
        scanf("%d", &data);
        data_list.push_back(data);
    }
    int K;
    scanf("%d", &K);
    for (int i = 0; i < data_list.size(); i++) {
        int data = data_list[i];
        if (data_set.find(data) == data_set.end()) {
            data_set.insert(data);
            q.push(data);
        }
        if (q.size() > K) {
            q.pop();
        }
    }
    int data = q.top();
    cout << data;
}