#include <bits/stdc++.h>
using namespace std;
const long long sz = 1e5 + 2;
const long long mod = 1e9 + 7;
const double PI = acos(-1);
const double eps = 1e-10;
const long long INF = 1e18 + 5;
long long power(long long n, long long k, long long m) {
  long long ans = 1;
  while (k) {
    if (k & 1) ans = (ans * n) % m;
    k /= 2;
    n = (n * n) % m;
  }
  return ans;
}
bool poss(const vector<long long> &a, long long n, long long ans, long long k,
          long long ok) {
  long long cnt = 0;
  for (int i = 0; i < int(n); i++) {
    if (a[i] <= ans && ok) {
      cnt++;
      ok = !ok;
    } else if (!ok) {
      cnt++;
      ok = !ok;
    }
  }
  return cnt >= k;
}
void solver() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (int i = 0; i < int(n); i++) cin >> a[i];
  long long l = 0, r = *max_element((a).begin(), (a).end()), ans = INF;
  while (l <= r) {
    long long mid = l + (r - l) / 2;
    if (poss(a, n, mid, k, 0) || poss(a, n, mid, k, 1)) {
      ans = min(ans, mid);
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  long long T = 1;
  for (int i = 1; i < int(T + 1); i++) {
    clock_t z = clock();
    solver();
    fprintf(stderr, "Total Time: %.3f\n",
            (double)(clock() - z) / CLOCKS_PER_SEC),
        fflush(stderr);
  }
  return 0;
}
