#include <bits/stdc++.h>
using namespace std;
int t, n, k, A[1000000];
vector<int> Less, Greater;
bool Check(int Val) {
  Less.clear();
  Greater.clear();
  for (int i = 1; i <= n; i++)
    if (A[i] <= Val)
      Less.push_back(i);
    else
      Greater.push_back(i);
  if (Less.size() == 0) return false;
  if (Less.size() >= k) return true;
  int Count1 = (k + 1) / 2, tmp1 = 1, pos1 = 0;
  while (pos1 <= Less.size() - 1 && Count1 != 0) {
    if (tmp1 % 2 == 1) {
      Count1--;
      pos1++;
      tmp1++;
      continue;
    }
    if (Less[pos1 - 1] == Less[pos1] - 1) pos1++;
    tmp1++;
  }
  if (Count1 == 0 &&
      ((pos1 != Less.size()) || (pos1 == Less.size() && tmp1 % 2 == 0 &&
                                 ((Less[Less.size() - 1] != n) ||
                                  (Less[Less.size() - 1] == n && k % 2 == 1)))))
    return true;
  int Count2 = k / 2, tmp2 = 2, pos2 = 0;
  if (Less[0] == 1) pos2++;
  while (pos2 <= Less.size() - 1 && Count2 != 0) {
    if (tmp2 % 2 == 0) {
      Count2--;
      pos2++;
      tmp2++;
      continue;
    }
    if (Less[pos2 - 1] == Less[pos2] - 1) pos2++;
    tmp2++;
  }
  if (Count2 == 0 &&
      ((pos2 != Less.size()) || (pos2 == Less.size() && tmp2 % 2 == 1 &&
                                 ((Less[Less.size() - 1] != n) ||
                                  (Less[Less.size() - 1] == n && k % 2 == 0)))))
    return true;
  return false;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> A[i];
  int Left = 1, Right = 1000000000, Ans;
  while (Left <= Right) {
    int mid = (Left + Right) / 2;
    if (Check(mid)) {
      Ans = mid;
      Right = mid - 1;
    } else
      Left = mid + 1;
  }
  cout << Ans;
}
