#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long mod = 1e9 + 7;
const int N = 5e5 + 10;
long long a[N];
int n, k;
bool check(long long val) {
  int idx = 0;
  int cnt = 0;
  int lim = n;
  if (k % 2 == 0) {
    lim--;
  }
  while (idx < lim) {
    if (a[idx] <= val) {
      cnt++;
      idx++;
    }
    idx++;
  }
  if (cnt >= (k + 1) / 2) {
    return true;
  }
  idx = 1;
  cnt = 0;
  lim = n;
  if (k % 2 == 1) {
    lim--;
  }
  while (idx < lim) {
    if (a[idx] <= val) {
      cnt++;
      idx++;
    }
    idx++;
  }
  if (cnt >= (k / 2)) {
    return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long lo = 1;
  long long hi = mod - 7;
  while (hi - lo > 1) {
    long long mid = (lo + hi) / 2;
    if (check(mid)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  if (check(lo)) {
    cout << lo << endl;
  } else {
    cout << hi << endl;
  }
  return 0;
}
