#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<long long> ve;
int n, k;
bool cmp(const long long &a, const long long &b) {
return a > b;
}
int main() {
cin >> n;
long long x;
for (int i = 0; i < n; i++){
cin >> x;
ve.push_back(x);
}
cin >> k;
sort(ve.begin(), ve.end(), cmp);
for (int i = 0; i < k; i++) {
cout << ve[i] << endl;
}
return 0;
}