#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
long long int modpow(long long int a, long long int b, long long int mod) {
  long long int res = 1;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a;
    res %= mod;
    a = a * a;
    a %= mod;
  }
  return res;
}
long long int p(long long int a, long long int b) {
  long long int res = 1;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a;
    a = a * a;
  }
  return res;
}
int isPrime(long long int n) {
  int flag = 1;
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      flag = 0;
      break;
    }
  }
  return flag;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a(n);
  long long int maxx = 0, minn = 1e15;
  for (int i = (int)0; i < (int)n; ++i) {
    cin >> a[i];
    maxx = ((maxx > a[i]) ? maxx : a[i]);
    minn = ((minn < a[i]) ? minn : a[i]);
  }
  long long int l = 0, h = 1e15;
  while (l < h) {
    long long int ans = (l + h) / 2;
    long long int cnt = 0, point = 0;
    while (point < n && a[point] <= ans) {
      point++;
      cnt++;
    }
    while (point < n) {
      if (a[point] <= ans) {
        int tcnt = 0;
        while (point < n && a[point] <= ans) {
          point++;
          tcnt++;
        }
        cnt += tcnt;
        if (point != n) cnt -= (1 - tcnt % 2);
      } else {
        cnt++;
        while (point < n && a[point] > ans) point++;
      }
    }
    if (cnt >= k) {
      h = ans;
    } else
      l = ans + 1;
  }
  cout << h << "\n";
}
