#include <bits/stdc++.h>
using namespace std;
bool cmp(int x, int y) { return x > y; }
vector<int> vec;
int main() {
  int n, k;
  cin >> n >> k;
  vec.resize(n);
  for (vector<int>::iterator it = vec.begin(); it != vec.end(); it++) {
    cin >> *it;
  }
  sort(vec.begin(), vec.end(), cmp);
  cout << vec[k - 1] << endl;
  return 0;
}
