#include <bits/stdc++.h>
using namespace std;
int n, k;
bool check(long long int m, vector<long long int> v, int c) {
  int a = 0;
  for (int i = 0; i < n; i++) {
    if (!c)
      a++, c ^= 1;
    else if (v[i] <= m)
      a++, c ^= 1;
  }
  return a >= k;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  vector<long long int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  long long int l = 1, h = 1e9, m = 0;
  while (l < h) {
    m = (l + h) / 2;
    if (check(m, v, 0) || check(m, v, 1))
      h = m;
    else
      l = m + 1;
  }
  cout << l << "\n";
  return 0;
}
