#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, c = 0;
  cin >> n >> k;
  vector<int> vec;
  for (int i = 0; i < n; ++i) {
    int temp;
    cin >> temp;
    vec.push_back(temp);
  }
  sort(vec.begin(), vec.end());
  int i = 0;
  while (c < k) {
    c = count(vec.begin(), vec.end() - i, vec[n - 1 - i]);
    c += i;
    ++i;
  }
  cout << vec[n - i] << "\n";
  return 0;
}
