#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long l = 1, h = 1e9;
  while (l < h) {
    long long mid = (l + h) / 2;
    long long len = 0;
    for (int i = 0; i < n; i++) {
      if (len % 2 != 0)
        len++;
      else if (a[i] <= mid)
        len++;
    }
    long long len2 = 0;
    for (int i = 0; i < n; i++) {
      if (len2 % 2 == 0)
        len2++;
      else if (a[i] <= mid)
        len2++;
    }
    if (len < k && len2 < k)
      l = mid + 1;
    else
      h = mid;
  }
  cout << h;
  return 0;
}
