#include <bits/stdc++.h>
int a[111];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  std::sort(a + 1, a + n + 1);
  printf("%d", a[n - k + 1]);
}
