#include <bits/stdc++.h>
using namespace std;
void dbg_out() { cerr << "\b\b]\n"; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << H << ", ";
  dbg_out(T...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  for (int &i : A) cin >> i;
  auto check = [&](int x, int pick) {
    int cnt = 0;
    int ini = pick;
    for (int i = 0; i < n; ++i) {
      if (pick and A[i] <= x) {
        cnt++;
        pick = !pick;
      } else if (!pick) {
        pick = !pick;
        cnt++;
      }
    }
    return (cnt >= k);
  };
  int lo = 0, hi = 1e9;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    if (check(mid, 0) || check(mid, 1)) {
      hi = mid;
    } else
      lo = mid + 1;
  }
  cout << lo;
  return 0;
}
