#include <bits/stdc++.h>
const long long inf = 0x3f3f3f3f3f3f3f3LL;
const long long mod = (long long)1e9 + 7;
using namespace std;
template <class T, class T2>
void smin(T& a, T2 val) {
  if (a > val) a = val;
}
template <class T, class T2>
void smax(T& a, T2 val) {
  if (a < val) a = val;
}
const long long N = 5 * (long long)1e5 + 10;
long long n, a[N], k;
bool f(long long mid) {
  long long len = 0;
  for (long long i = 0; i < n and len <= k; ++i) {
    if (len % 2 == 0) {
      if (a[i] <= mid) ++len;
    } else {
      ++len;
    }
  }
  if (len >= k) {
    return 1;
  }
  len = 0;
  for (long long i = 0; i < n and len <= k; ++i) {
    if (len % 2 == 0) {
      ++len;
    } else {
      if (a[i] <= mid) ++len;
    }
  }
  return len >= k;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long low = 1, high = *max_element(a, a + n);
  long long ans = 1e9;
  while (low <= high) {
    long long mid = (low + high) >> 1;
    if (f(mid)) {
      ans = mid;
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  cout << ans;
  return 0;
}
