#include <bits/stdc++.h>
using namespace std;
void qsort(long[], long, long);
void swap(long &, long &);
int main() {
  long n, k, a[100];
  cin >> n >> k;
  for (long i = 0; i < n; i++) cin >> a[i];
  qsort(a, 0, n - 1);
  cout << a[k - 1] << endl;
  return 0;
}
void qsort(long a[100], long left, long right) {
  long low = left, high = right;
  long mid = a[(low + high) / 2];
  while (low <= high) {
    while (a[low] > mid) low++;
    while (a[high] < mid) high--;
    if (low <= high) {
      swap(a[low], a[high]);
      low++;
      high--;
    }
  }
  if (left < high) qsort(a, left, high);
  if (right > low) qsort(a, low, right);
}
void swap(long &a, long &b) {
  long t = a;
  a = b;
  b = t;
}
