#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<long long> a;
bool bs(long long val, long long k, long long index, long long n) {
  long long prev = 0;
  long long prevv = 0;
  for (long long i = index; i < n; i++) {
    if (a[i] <= val) {
      long long temp = prev;
      prev = prevv + 1;
      prevv = temp;
      prev = max(prevv, prev);
    } else {
      long long temp = max(prev, prevv);
      prev = prevv = temp;
    }
    if (prev >= k) return 1;
  }
  return (prev >= k || prevv >= k);
}
signed main() {
  cin >> n >> k;
  long long k1, k2, end1, end2;
  if (k % 2 == 0) {
    k1 = k / 2;
    k2 = k / 2;
    end1 = n - 1;
    end2 = n;
  } else {
    k1 = k / 2 + 1;
    k2 = k / 2;
    end1 = n;
    end2 = n - 1;
  }
  a = vector<long long>(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long start = 1;
  long long end = 1e9;
  while (start <= end) {
    long long mid = (start + end) / 2;
    if (bs(mid, k1, 0, end1) || bs(mid, k2, 1, end2)) {
      end = mid - 1;
    } else
      start = mid + 1;
  }
  cout << end + 1 << endl;
  return 0;
}
