#include <iostream>
using namespace std;
const int N = 100010;
int n, k;
int q[N];
int f(int l, int r) {
if (l >= r) return q[l];
int x = q[(l + r) >> 1];
int i = l - 1, j = r + 1;
while (i < j) {
while (q[++i] < x);
while (q[--j] > x);
if (i < j) swap(q[i], q[j]);
}
if (k <= j) return f(l, j);
else return f(j + 1, r);
}
int main() {
cin >> n >> k;
for (int i = 1; i <= n; ++i) cin >> q[i];
cout << f(1, n) << endl;
return 0;
}