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