#include <bits/stdc++.h>
using namespace std;
int a[500005], n, k;
inline int pd(int x) {
  int cnt = 0, lst = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] <= x) {
      if (i > lst + 1) {
        lst = i;
        cnt += 2;
      }
    }
  }
  if (lst < n) ++cnt;
  if (a[1] <= x) {
    int Cnt = 0;
    lst = -1;
    for (int i = 1; i <= n; i++) {
      if (a[i] <= x) {
        if (i > lst + 1) {
          lst = i;
          Cnt += min(i, 2);
        }
      }
    }
    if (lst < n) ++Cnt;
    cnt = max(cnt, Cnt);
  }
  return cnt >= k;
}
int main(int argc, char** argv) {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int l = 1, r = 1000000000, ans = 1e9;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (pd(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  cout << ans;
  return 0;
}
