#include <bits/stdc++.h>
using namespace std;
long long x, x2, y, y2, n, m, k, a, b, rep, koliko, koliko2, p;
long long hi, lo, mid;
bool t;
char c;
string s;
int main() {
  vector<long long> V;
  cin >> n >> k;
  k = n - k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    V.push_back(x);
  }
  lo = 1;
  hi = 1000000010;
  while (lo < hi) {
    mid = (lo + hi) / 2;
    koliko = 0;
    p = 0;
    while (p < V.size()) {
      if (V[p] > mid) {
        koliko++;
        p++;
      } else {
        p += 2;
      }
    }
    koliko2 = 0;
    p = 1;
    while (p < V.size()) {
      if (V[p] > mid) {
        koliko2++;
        p++;
      } else {
        p += 2;
      }
    }
    if (min(koliko, koliko2) <= k) {
      hi = mid;
    } else {
      lo = mid + 1;
    }
  }
  cout << lo << "\n";
}
