#include <bits/stdc++.h>
using namespace std;
const int next_x[8] = {0, 1, -1, 0, 1, 1, -1, -1};
const int next_y[8] = {1, 0, 0, -1, 1, -1, -1, 1};
const int inf = 1e9 + 5;
const long long linf = 1e18;
const double PI = acos(-1.0);
const int MAXN = 2e5 + 5;
const int N = 1e7;
int n, k;
int a[MAXN];
bool check(int mn) {
  int len = 0;
  for (register int i = (1), I = (n) + 1; i < I; ++i) {
    if (a[i] <= mn)
      len++;
    else if (len & 1)
      len++;
  }
  if (len >= 1 && len >= k) return 1;
  len = 0;
  for (register int i = (1), I = (n) + 1; i < I; ++i) {
    if (a[i] <= mn)
      len++;
    else if (len % 2 == 0)
      len++;
  }
  if (len >= 2 && len >= k) return 1;
  return 0;
}
int work() {
  scanf("%d%d", &n, &k);
  for (register int i = (1), I = (n) + 1; i < I; ++i) scanf("%d", &a[i]);
  check(1);
  int l = 1, r = 1e9, ans = r;
  while (l <= r) {
    if (check(((l + r) / 2)))
      ans = ((l + r) / 2), r = ((l + r) / 2) - 1;
    else
      l = ((l + r) / 2) + 1;
  }
  return printf("%d\n", ans);
}
int main() {
  work();
  return 0;
}
