#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = (int)1e9 + 7;
const int nax = (int)2e5 + 5;
int n, k;
vector<int> a(nax);
bool func(int cur, int parity) {
  int knt = 0;
  for (ll i = 0; i < n; i++) {
    if (!parity) {
      knt++;
      parity ^= 1;
    } else if (a[i] <= cur) {
      knt++;
      parity ^= 1;
    }
  }
  return knt >= k;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (ll i = 0; i < n; i++) cin >> a[i];
  int l = 1, r = 1e9, ans = 1e9;
  while (l <= r) {
    int mid = l + (r - l) / 2;
    if (func(mid, 0) || func(mid, 1)) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  cout << ans << '\n';
  return 0;
}
