#include <bits/stdc++.h>
using namespace std;
const int N = 200050;
int a[N];
bool solve(int mid, int k, int n) {
  vector<int> v;
  for (int i = 1; i <= n; i++) {
    if (a[i] <= mid) v.push_back(i);
  }
  if (!(int)(v.size())) return false;
  int k1 = 1;
  int k2 = 0;
  int current = v[0];
  for (int i = 1; i < (int)(v.size()); i++) {
    if (v[i] == current + 1)
      continue;
    else {
      k1++;
      current = v[i];
    }
  }
  if (k & 1) {
    if (k1 >= (k + 1) / 2) return true;
  } else {
    if (k1 > k >> 1 || ((k1 == k >> 1) && (v[0] != 1 || current != n)))
      return true;
  }
  current = 0;
  if (k & 1) {
    for (int i = 0; i < (int)(v.size()); i++) {
      if (v[i] == current + 1 || v[i] == n)
        continue;
      else {
        k2++;
        current = v[i];
      }
    }
    if (k2 >= k >> 1)
      return true;
    else
      return false;
  } else {
    for (int i = 0; i < (int)(v.size()); i++) {
      if (v[i] == current + 1)
        continue;
      else {
        k2++;
        current = v[i];
      }
    }
    if (k2 >= k >> 1)
      return true;
    else
      return false;
  }
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  int l = 0;
  int r = 1e9 + 10;
  int ans = 0;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (solve(mid, k, n)) {
      ans = mid;
      r = mid;
    } else
      l = mid + 1;
  }
  printf("%d", ans);
  return 0;
}
