#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N], n, k;
bool chk(int aim) {
  int cur = 0;
  for (int i = 0; i < n; i++) {
    if ((cur & 1) || a[i] <= aim) {
      cur++;
    }
  }
  if (cur >= k) return true;
  cur = 0;
  for (int i = 0; i < n; i++) {
    if ((~cur & 1) || a[i] <= aim) {
      cur++;
    }
  }
  return cur >= k;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int left = 1, right = 1000000000, ans = -1;
  while (left <= right) {
    int mid = (left + right) >> 1;
    if (chk(mid)) {
      ans = mid;
      right = mid - 1;
    } else {
      left = mid + 1;
    }
  }
  cout << ans << '\n';
}
