#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
  int n, k;
  int a[105];
  while (scanf("%d%d", &n, &k) != -1) {
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    sort(a, a + n, cmp);
    printf("%d\n", a[k - 1]);
  }
  return 0;
}
