#include<bits/stdc++.h>
using namespace std;
int main() {
    int n, k;
    vector<int>a;
    // write your code here......
    int x;

    cin >> n >> k;
    while (cin >> x) {
        a.push_back(x);
    }

    sort(a.begin(), a.end());
    cout << a.at(k - 1) << endl;

    return 0;
}