#include <bits/stdc++.h>
const double PI = 3.141592653589793238460;
const long long int MOD = 1000000007;
using namespace std;
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
bool check(vector<long long int> a, long long int m, long long int k,
           long long int s) {
  long long int cnt = 0;
  for (int i = int(0); i <= int(a.size() - 1); i++) {
    if (a[i] <= m || cnt % 2 != s) cnt++;
  }
  return cnt >= k;
}
int main() {
  long long int n, k, s = 0, l = 1e9, m, ans = 1e9;
  cin >> n >> k;
  vector<long long int> a(n);
  for (int i = int(0); i <= int(n - 1); i++) cin >> a[i];
  while (s <= l) {
    m = s + (l - s) / 2;
    if (check(a, m, k, 0) || check(a, m, k, 1))
      ans = m, l = m - 1;
    else
      s = m + 1;
  }
  cout << ans << endl;
  return 0;
}
