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