#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a[200];
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a, a + n);
  cout << a[n - k] << endl;
  cin >> n;
  return 0;
}
