#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n,k;
	vector<int>a;
	// write your code here......
	cin>>n>>k;
	while(n--)
	{
		int x;
		cin>>x;
		a.push_back(x);
	}
	nth_element(a.begin(), a.begin()+k-1, a.end());
	vector<int>::iterator it = a.begin()+k-1;
	cout<<*it<<endl;

	return 0;
}