#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long max_n = 1e5 + 5;
const long long log_n = 20;
const long long inf = 1e9;
const long double pi = acos(-1);
bool check(vector<long long> &a, long long val, long long k) {
  vector<long long> b;
  for (long long i = 0; i < a.size(); ++i) {
    if (a[i] <= val) b.push_back(i);
  }
  vector<pair<long long, long long> > c;
  bool mbo = 0;
  for (long long i = 0; i < b.size();) {
    long long cnt = 0;
    long long el = b[i] - 1;
    long long ok = 1;
    bool used = 0;
    long long beg = i;
    while (i < b.size() && b[i] == el + 1) {
      if (a[b[i]] == val && (i - beg) % 2 == 0) ok = 0;
      if (a[b[i]] == val) used = 1;
      el = b[i];
      i++;
      cnt++;
    }
    if (!used) ok = 0;
    if (cnt % 2 != 0 && !ok) mbo = 1;
    if (cnt % 2 == 0 && used) mbo = 1;
    c.push_back({cnt, ok});
  }
  bool ok = 0;
  long long res = 0;
  for (auto el : c) {
    if (!ok && !mbo && el.first % 2 != 0 && el.second == 1) {
      ok = 1;
      res += el.first / 2;
      continue;
    }
    res += (el.first + 1) / 2;
  }
  return res >= k;
}
void run() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  if (n == 2) {
    cout << min(a[0], a[1]) << '\n';
    return;
  }
  vector<long long> b = a;
  b.erase(b.begin());
  if (k % 2 != 0)
    b.pop_back();
  else
    a.pop_back();
  vector<long long> asrt = a;
  sort(asrt.begin(), asrt.end());
  asrt.erase(unique(asrt.begin(), asrt.end()), asrt.end());
  long long l = -1;
  long long r = asrt.size();
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (check(a, asrt[mid], (k + 1) / 2)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  long long ans;
  if (r != asrt.size())
    ans = asrt[r];
  else
    ans = inf;
  vector<long long> bsrt = b;
  sort(bsrt.begin(), bsrt.end());
  bsrt.erase(unique(bsrt.begin(), bsrt.end()), bsrt.end());
  l = -1;
  r = bsrt.size();
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (check(b, bsrt[mid], k / 2)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  if (r != bsrt.size()) ans = min(bsrt[r], ans);
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) run();
  return 0;
}
