#include <bits/stdc++.h>
using namespace std;
const int mx5 = 200005;
const int mn6 = 1000005;
int _toggle(int N, int pos) { return N = N ^ (1 << pos); }
int _set(int N, int pos) { return N = N | (1 << pos); }
int _reset(int N, int pos) { return N = N & ~(1 << pos); }
bool _check(int N, int pos) { return (bool)(N & (1 << pos)); }
bool _upper(char a) { return a >= 'A' && a <= 'Z'; }
bool _lower(char a) { return a >= 'a' && a <= 'z'; }
bool _digit(char a) { return a >= '0' && a <= '9'; }
int dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
int dy[] = {0, 0, 1, -1, -1, 1, -1, 1};
int n, k, a[mx5];
bool check(int x, int pr) {
  int sl = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] <= x || sl % 2 == pr) {
      sl++;
    }
  }
  return sl >= k;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int lo = 0, hi = 1e9 + 1;
  for (int i = 1; i < 35; i++) {
    int mid = (lo + hi) >> 1;
    if (check(mid, 0) || check(mid, 1)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  cout << hi << '\n';
}
