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