#include <bits/stdc++.h>
using namespace std;
int a, b, i, j, n, k, p, q, l, r, temp, t, s[105], ans, len;
int main() {
  while (~scanf("%d", &n)) {
    scanf("%d", &k);
    for (int i = 0; i < n; i++) {
      scanf("%d", &s[i]);
    }
    sort(s, s + n, greater<int>());
    printf("%d\n", s[k - 1]);
  }
  return 0;
}
