include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
int n,m;
const int N = 1e5+10;
int q[N];
void qucik_sort(int q[], int l ,int r ){
if(l>=r)return;
int x=q[(l+r+1)/2] ; int i = l-1 ; int j=r+1;
while(i<j){
do i++ ;while(q[i]<x);
do j-- ;while(q[j]>x);
if(i<j)swap(q[i],q[j]);
}
qucik_sort(q,l,i-1);
qucik_sort(q,i,r);
}
int main(){
cin>>n>>m;
for (int i = 0; i < n; i ++ ){
cin>>q[i];
}
qucik_sort(q ,0 , n-1);
cout<<q[m-1];
return 0;
}