#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int low = 0, high = *max_element(a.begin(), a.end());
  while (low < high) {
    int mid = (low + high) / 2;
    bool ok = false;
    for (int flag : {0, 1}) {
      int found = 0;
      for (int i = 0; i < n; i++) {
        if (a[i] <= mid) {
          found++;
          flag = 1 - flag;
        } else if (flag == 1) {
          found++;
          flag = 1 - flag;
        }
      }
      if (found >= k) ok = true;
    }
    if (ok)
      high = mid;
    else
      low = mid + 1;
  }
  cout << low << '\n';
}
