#include <bits/stdc++.h>
using namespace std;
const double eps = 0.00001;
const int MOD = 1000000007;
const int INF = 1000055555;
const long long LLINF = 1223372000000000555;
const int N = 1456789;
const int M = 1234;
int n, k;
int a[N];
bool check(int x, int cur) {
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (!cur) {
      cnt++;
      cur ^= 1;
    } else {
      if (a[i] <= x) cnt++, cur ^= 1;
    }
  }
  return cnt >= k;
}
void solve() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int ans = 0;
  int l = 0, r = 1e9;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid, 0) || check(mid, 1)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
