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