#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace std;
ifstream in("sdo.in");
ofstream out("sdo.out");
const int NMAX = 3000001;
int *A;
int n,k;
void quicksort(int x,int y)
{
if(x<y)
{
int i=x,j=y;
//swap(A[x],A[i+rand()%(j-i+1)]);
int pivot = A[x];
while(i<j)
{
if(A[i] > A[j])
swap(A[i],A[j]);
if(A[i]==pivot)
j--;
else
i++;
}
int m = i;
if(m > k)
quicksort(x,m-1);
else
quicksort(m+1,y);
}
}
int main()
{
in>>n>>k;
A = new int[n+1];
for(int i=1;i<=n;i++)
in>>A[i];
in.close();
quicksort(1,n);
out<<A[k]<<"\n";
delete[] A;
return 0;
}