#include <bits/stdc++.h>
using namespace std;
template <typename _Tp, typename _Up>
bool maximize(_Tp &__a, _Up __b) {
  if (__a < __b) {
    __a = __b;
    return true;
  }
  return false;
}
template <typename _Tp, typename _Up>
bool minimize(_Tp &__a, _Up __b) {
  if (__a > __b) {
    __a = __b;
    return true;
  }
  return false;
}
const long long siz = 2e5 + 2;
const long long SIZ = 1e6 + 2;
const long long mod = 1e9 + 7;
const long long maxx = 2e9;
const long long MAXX = 1e18;
const string file = "3";
long long n, k;
long long a[siz];
bool check(long long val) {
  long long cur_0 = 0, cur_1 = 1;
  long long len_0 = 0, len_1 = 0;
  for (long long i = 1; i <= n; i++) {
    if (cur_0 == 0) {
      cur_0 ^= 1;
      len_0++;
    } else {
      if (a[i] <= val) {
        cur_0 ^= 1;
        len_0++;
      }
    }
    if (cur_1 == 0) {
      cur_1 ^= 1;
      len_1++;
    } else {
      if (a[i] <= val) {
        cur_1 ^= 1;
        len_1++;
      }
    }
  }
  return (len_0 >= k || len_1 >= k);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long ans = -1;
  for (long long lt = 1, rt = 1e9; lt <= rt;) {
    long long mid = (lt + rt) / 2;
    if (check(mid)) {
      ans = mid;
      rt = mid - 1;
    } else {
      lt = mid + 1;
    }
  }
  cout << ans << "\n";
  return 0;
}
