#include<iostream>
using namespace std;
int partition(int *l,int low,int high);
void findk(int k,int *l,int low,int high);
void qsort(int *l,int low,int high);
int main() {
int m, k;
cin >> m >> k;
int a[m];
for (int i = 0; i < m;i++) {
cin >> a[i];
}
getchar();
findk(k,a,0,m-1);
getchar();
return 0;
}
int partition(int *l,int low,int high) {
int temp=l[low];
int p = l[low];
while (low != high) {
while (low < high&&l[high] <= p) {
high--;
}
l[low] = l[high];
while (low < high&&l[low] >= p) {
low++;
}
l[high] = l[low];
}
l[low] = temp;
return low;
}
void findk(int k,int *l,int low,int high) {
int temp;
temp = partition(l,low,high);
if (temp == k - 1) {
cout << l[temp];
}
else if (temp<k-1) {
findk(k, l, temp + 1, high);
}
else {
findk(k, l, low, temp - 1);
}
}