#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cout << '\n'; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << '[' << *it << " = " << a << "]  ";
  err(++it, args...);
}
mt19937 rng(
    (unsigned int)chrono::steady_clock::now().time_since_epoch().count());
int rnd(int a, int b) { return a + (rng() % (b - a + 1)); }
const long long int M = 1000000007ll;
const double D = 1.0;
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
int n, k;
vector<int> a;
bool pos(int u) {
  int s = 0;
  bool f = false;
  for (int i = 0; i < n; ++i) {
    if (!f) {
      f = !f;
      s++;
    } else {
      if (a[i] <= u) {
        s++;
        f = !f;
      }
    }
  }
  if (s >= k) return true;
  s = 0;
  f = false;
  for (int i = 0; i < n; ++i) {
    if (f) {
      f = !f;
      s++;
    } else {
      if (a[i] <= u) {
        s++;
        f = !f;
      }
    }
  }
  if (s >= k) return true;
  return false;
}
void solve() {
  cin >> n >> k;
  vector<int> b(n);
  a = vector<int>(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b.begin(), b.end());
  int lo = 0, hi = n - 1, mid, ans = -1;
  while (lo < hi) {
    mid = lo + (hi - lo) / 2;
    if (pos(b[mid])) {
      hi = mid;
      ans = b[mid];
    } else {
      lo = mid + 1;
    }
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc = 1;
  while (tc--) {
    solve();
  }
  return 0;
}
