#include <bits/stdc++.h>
using namespace std;
const int mxn = 2e5 + 5;
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
long long arr[mxn];
int n, k;
int check(int x, int y) {
  int len = 0, pos = 1;
  while (pos <= n) {
    if ((len & 1) == y) {
      if (arr[pos] <= x) len++;
    } else
      len++;
    pos++;
  }
  if (len >= k) return true;
  return false;
}
int main() {
  scanf("%d%d", &n, &k);
  long long ans = 1e12, lo = 1e12, hi = -1;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
    lo = min(lo, arr[i]);
    hi = max(hi, arr[i]);
  }
  while (hi - lo > 10) {
    long long mid = (lo + hi) >> 1;
    if (check(mid, 0) || check(mid, 1)) {
      ans = min(ans, mid);
      hi = mid - 1;
    } else
      lo = mid + 1;
  }
  for (long long i = lo; i <= hi; i++)
    if (check(i, 0) || check(i, 1)) ans = min(ans, i);
  cout << ans << '\n';
  return 0;
}
