#include <bits/stdc++.h>
using namespace std;
int ceilingOf(double a) {
  if (a == (int)a) return (int)a;
  return (int)a + 1;
}
int floorOf(double a) { return (int)a; }
long long maximum(long long x, long long y) {
  if (x > y) return x;
  return y;
}
int minimum(int x, int y) {
  if (x < y) return x;
  return y;
}
void shuffle_array(int arr[], int n) { random_shuffle(arr, arr + n); }
void print_array(int arr[], int n) {
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
  cout << '\n';
}
void print_array(bool arr[], int n) {
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
  cout << '\n';
}
void print_array(long long arr[], int n) {
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
  cout << '\n';
}
void swap(int* a, int* b) {
  int t = *a;
  *a = *b;
  *b = t;
}
void print_array(char** arr, int N, int M) {
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) cout << arr[i][j] << " ";
    cout << '\n';
  }
}
void print_array(int** arr, int N, int M) {
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) cout << arr[i][j] << " ";
    cout << '\n';
  }
}
void print_array(long long** arr, int N, int M) {
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) cout << arr[i][j] << " ";
    cout << '\n';
  }
}
int floodArea(int N, int M, bool** pos, bool** visited, int i, int j) {
  if (pos[i][j] == 0) return 0;
  list<int> a;
  int maxar = -INT_MAX;
  visited[i][j] = 1;
  a.push_back((N + M) * i + j);
  int counts = 1;
  while (!a.empty()) {
    int index = a.back();
    a.pop_back();
    int row = index / (M + N);
    int col = index % (M + N);
    if ((row + 1 < N) && visited[row + 1][col] == 0 &&
        pos[row + 1][col] == pos[i][j]) {
      visited[row + 1][col] = 1;
      a.push_back((M + N) * (row + 1) + col);
      counts++;
    }
    if ((col + 1 < M) && visited[row][col + 1] == 0 &&
        pos[row][col + 1] == pos[i][j]) {
      visited[row][col + 1] = 1;
      a.push_back((M + N) * row + (col + 1));
      counts++;
    }
    if ((row - 1 >= 0) && visited[row - 1][col] == 0 &&
        pos[row - 1][col] == pos[i][j]) {
      visited[row - 1][col] = 1;
      a.push_back((M + N) * (row - 1) + col);
      counts++;
    }
    if ((col - 1 >= 0) && visited[row][col - 1] == 0 &&
        pos[row][col - 1] == pos[i][j]) {
      visited[row][col - 1] = 1;
      a.push_back((M + N) * row + (col - 1));
      counts++;
    }
  }
  if (counts > maxar) {
    maxar = counts;
  }
  return maxar;
}
void deleteFlood(int N, int M, int** pos, int** visited, int i, int j) {
  int val = pos[i][j];
  pos[i][j] = 0;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++) visited[i][j] = 0;
  list<int> a;
  int maxar = -INT_MAX;
  visited[i][j] = 1;
  a.push_back((N + M) * i + j);
  int counts = 1;
  while (!a.empty()) {
    int index = a.back();
    a.pop_back();
    int row = index / (M + N);
    int col = index % (M + N);
    if ((row + 1 < N)) {
      if (visited[row + 1][col] == 0 && pos[row + 1][col] == val) {
        visited[row + 1][col] = 1;
        a.push_back((M + N) * (row + 1) + col);
        pos[row + 1][col] = 0;
      }
    }
    if ((col + 1 < M)) {
      if (visited[row][col + 1] == 0 && pos[row][col + 1] == val) {
        visited[row][col + 1] = 1;
        a.push_back((M + N) * row + (col + 1));
        pos[row][col + 1] = 0;
      }
    }
    if ((row - 1 >= 0)) {
      if (visited[row - 1][col] == 0 && pos[row - 1][col] == val) {
        visited[row - 1][col] = 1;
        a.push_back((M + N) * (row - 1) + col);
        pos[row - 1][col] = 0;
      }
    }
    if ((col - 1 >= 0)) {
      if (visited[row][col - 1] == 0 && pos[row][col - 1] == val) {
        visited[row][col - 1] = 1;
        a.push_back((M + N) * row + (col - 1));
        pos[row][col - 1] = 0;
      }
    }
  }
}
void print_vector(vector<int> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) cout << *i << " ";
  cout << '\n';
}
void print_vector(vector<char> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) cout << *i << " ";
  cout << '\n';
}
void print_vector(vector<long long> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) cout << *i << " ";
  cout << '\n';
}
void print_vector(vector<double> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) cout << *i << " ";
  cout << '\n';
}
void print_vector(vector<int> amount, int N) {
  for (auto i = amount.begin(); i != amount.begin() + N; i++) cout << *i << " ";
  cout << '\n';
}
void print_vector(vector<string> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) cout << *i << " ";
  cout << '\n';
}
void print_vector(vector<bool> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) cout << *i << " ";
  cout << '\n';
}
void print_vector(vector<pair<int, int>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++)
    cout << (*i).first << " ";
  cout << '\n';
  for (auto i = amount.begin(); i != amount.end(); i++)
    cout << (*i).second << " ";
  cout << '\n';
}
void print_vector(vector<pair<long long, long long>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++)
    cout << (*i).first << " ";
  cout << '\n';
  for (auto i = amount.begin(); i != amount.end(); i++)
    cout << (*i).second << " ";
  cout << '\n';
}
void print_vector(vector<pair<string, int>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++)
    cout << (*i).first << " " << (*i).second << '\n';
  cout << '\n';
}
void print_vector(vector<pair<pair<int, int>, int>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++)
    cout << (*i).first.first << " " << (*i).first.second << " " << (*i).second
         << '\n';
  cout << '\n';
}
void print_vector(vector<pair<int, pair<int, int>>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++)
    cout << (*i).first << " " << (*i).second.first << " " << (*i).second.second
         << '\n';
  cout << '\n';
}
void print_vector(vector<tuple<int, int, int, int>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++)
    cout << get<0>(*i) << " " << get<1>(*i) << " " << get<2>(*i) << " "
         << get<3>(*i) << '\n';
  cout << '\n';
}
void print_vector(vector<vector<string>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) {
    print_vector(*i);
    cout << '\n';
  }
  cout << '\n';
}
void print_vector(vector<vector<int>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) {
    cout << i - amount.begin() << '\n';
    print_vector(*i);
    cout << '\n';
  }
  cout << '\n';
}
void print_vector(vector<vector<long long>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) {
    cout << i - amount.begin() << '\n';
    print_vector(*i);
    cout << '\n';
  }
  cout << '\n';
}
void print_vector(vector<vector<pair<long long, long long>>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) {
    cout << i - amount.begin() << '\n';
    print_vector(*i);
  }
  cout << '\n';
}
void print_vector(vector<vector<vector<int>>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) {
    cout << i - amount.begin() << '\n';
    print_vector(*i);
    cout << '\n';
  }
  cout << '\n';
}
void print_vector(vector<vector<vector<long long>>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) {
    cout << i - amount.begin() << '\n';
    print_vector(*i);
    cout << '\n';
  }
  cout << '\n';
}
void print_vector(vector<vector<bool>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) {
    print_vector(*i);
    cout << '\n';
  }
  cout << '\n';
}
void print_set(set<int> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) cout << *i << " ";
  cout << '\n';
}
void print_set(set<pair<int, int>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++)
    cout << i->first << " " << i->second << '\n';
  cout << '\n';
}
void print_vector(vector<set<int>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) {
    cout << i - amount.begin() << '\n';
    print_set(*i);
    cout << '\n';
  }
  cout << '\n';
}
void print_vector(vector<vector<pair<int, int>>> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) {
    cout << i - amount.begin() << '\n';
    print_vector(*i);
  }
}
void print_set(set<string> amount) {
  for (auto i = amount.begin(); i != amount.end(); i++) cout << *i << " ";
  cout << '\n';
}
void print_map(map<int, vector<int>> m) {
  for (map<int, vector<int>>::iterator i = m.begin(); i != m.end(); i++) {
    cout << i->first << " ";
    print_vector(i->second);
  }
}
void print_map(map<string, vector<string>> m) {
  for (map<string, vector<string>>::iterator i = m.begin(); i != m.end(); i++) {
    cout << i->first << " ";
    print_vector(i->second);
  }
}
void print_map(map<string, vector<bool>> m) {
  for (map<string, vector<bool>>::iterator i = m.begin(); i != m.end(); i++) {
    cout << i->first << " ";
    print_vector(i->second);
  }
}
void print_map(map<string, set<string>> m) {
  for (auto i = m.begin(); i != m.end(); i++) {
    cout << i->first << " ";
    print_set(i->second);
  }
}
void print_map_vector(map<string, vector<bool>> m) {
  for (auto i = m.begin(); i != m.end(); i++) {
    cout << i->first << " ";
    print_vector(i->second);
  }
}
void print_map(map<int, bool> m) {
  for (map<int, bool>::iterator i = m.begin(); i != m.end(); i++) {
    cout << i->first << " " << i->second << '\n';
  }
}
void print_map(map<int, int> m) {
  for (map<int, int>::iterator i = m.begin(); i != m.end(); i++) {
    cout << i->first << " " << i->second << '\n';
  }
}
void print_map(map<char, vector<string>> m) {
  for (auto i = m.begin(); i != m.end(); i++) {
    cout << i->first << '\n';
    cout << '\t';
    print_vector(i->second);
  }
}
void print_map(map<char, int> m) {
  for (auto i = m.begin(); i != m.end(); i++) {
    cout << i->first << '\n';
    cout << '\t' << i->second << '\n';
  }
}
void print_map(map<pair<int, int>, int> m) {
  for (auto i = m.begin(); i != m.end(); i++) {
    cout << i->first.first << " " << i->first.second << " " << i->second
         << '\n';
  }
}
bool comp(pair<int, int> x, pair<int, int> y) {
  if (x.second > y.second) {
    return 0;
  }
  if (x.second == y.second) {
    return x.first < y.first;
  }
  return 1;
}
class segment_tree {
  vector<int> tree;
  int height;
  int maxSize;
  int STARTINDEX = 0;
  int ENDINDEX;

 public:
  segment_tree(int n) {
    height = (int)ceilingOf(log2(n));
    maxSize = (1 << (height + 1)) - 1;
    tree.resize(maxSize);
    ENDINDEX = (1 << height) - 1;
  }

 public:
  int leftChild(int k) { return 2 * k + 1; }

 public:
  int rightChild(int k) { return 2 * k + 2; }

 public:
  void buildSegTree(vector<int>& A) {
    A.resize(1 << height, 0);
    buildSegTreeRec(STARTINDEX, ENDINDEX, 0, A);
  }

 public:
  int buildSegTreeRec(int low, int high, int p, vector<int>& A) {
    if (low == high) {
      tree[p] = A[low];
      return tree[p];
    }
    int mid = (low + high) / 2;
    tree[p] = buildSegTreeRec(low, mid, leftChild(p), A) +
              buildSegTreeRec(mid + 1, high, rightChild(p), A);
    return tree[p];
  }

 public:
  int getSum(int x, int y) {
    if (x < 0 || ENDINDEX < y) return -INT_MAX;
    return getSumRec(STARTINDEX, ENDINDEX, x, y, 0);
  }

 public:
  int getSumRec(int low, int high, int x, int y, int p) {
    if (x <= low && high <= y) return tree[p];
    if (y < low || high < x) return 0;
    int mid = (low + high) / 2;
    return getSumRec(low, mid, x, y, leftChild(p)) +
           getSumRec(mid + 1, high, x, y, rightChild(p));
  }

 public:
  void addValue(int pos, int val) {
    addValueRec(STARTINDEX, ENDINDEX, pos, val, 0);
  }

 public:
  void set_remove(int pos, int val) {
    addValueRec(STARTINDEX, ENDINDEX, pos,
                max(val, tree[pos + (maxSize + 1) / 2]), 0);
  }

 public:
  void remove_index(int index) { remove_index_rec(0, index + 1); }

 public:
  void remove_index_rec(int index, int sum) {
    if (leftChild(index) >= maxSize) {
      addValue(index - (maxSize + 1) / 2 + 1, -1);
      return;
    }
    if (tree[leftChild(index)] < sum)
      remove_index_rec(rightChild(index), sum - tree[leftChild(index)]);
    else
      remove_index_rec(leftChild(index), sum);
  }

 public:
  void addValueRec(int low, int high, int pos, int val, int p) {
    if (low <= pos && pos <= high) {
      tree[p] = tree[p] + val;
      if (low != high) {
        int mid = (low + high) / 2;
        addValueRec(low, mid, pos, val, leftChild(p));
        addValueRec(mid + 1, high, pos, val, rightChild(p));
      }
    }
  }

 public:
  void print() { print_vector(tree); }

 public:
  void print_set() {
    int a = 0;
    for (int i = (0); i < (tree.size()); ++i)
      if (i >= maxSize / 2 && tree[i] != 0) {
        for (int j = (0); j < (tree[i]); ++j) {
          a = 1;
          cout << i - maxSize / 2 << " ";
        }
      }
    if (a == 1)
      cout << '\n';
    else
      cout << 0 << '\n';
  }

 public:
  void print_any() {
    int a = 0;
    for (int i = (0); i < (tree.size()); ++i)
      if (i >= maxSize / 2 && tree[i] != 0) {
        for (int j = (0); j < (tree[i]); ++j) {
          cout << i - maxSize / 2 << " ";
          return;
        }
      }
    cout << 0 << '\n';
  }
};
class max_tree {
  vector<int> tree;
  int counts = 0;
  int height;
  int maxSize;
  int STARTINDEX = 0;
  int ENDINDEX;

 public:
  max_tree(int n) {
    height = (int)ceilingOf(log2(n));
    maxSize = (1 << (height + 1)) - 1;
    tree.resize(maxSize);
    ENDINDEX = (1 << height) - 1;
  }

 public:
  int leftChild(int k) { return 2 * k + 1; }

 public:
  int rightChild(int k) { return 2 * k + 2; }

 public:
  void build_max_tree(vector<int>& A) {
    A.resize(1 << height, 0);
    buildSegTreeRec(STARTINDEX, ENDINDEX, 0, A);
  }

 public:
  int buildSegTreeRec(int low, int high, int p, vector<int>& A) {
    if (low == high) {
      tree[p] = A[low];
      return tree[p];
    }
    int mid = (low + high) / 2;
    tree[p] = max(buildSegTreeRec(low, mid, leftChild(p), A),
                  buildSegTreeRec(mid + 1, high, rightChild(p), A));
    return tree[p];
  }

 public:
  int get_max(int x, int y) {
    if (x < 0 || ENDINDEX < y) return -INT_MAX;
    return get_max1(STARTINDEX, ENDINDEX, x, y, 0);
  }

 public:
  int get_max1(int low, int high, int x, int y, int p) {
    if (x <= low && high <= y) return tree[p];
    if (y < low || high < x) return 0;
    int mid = (low + high) / 2;
    return max(get_max1(low, mid, x, y, leftChild(p)),
               get_max1(mid + 1, high, x, y, rightChild(p)));
    ;
  }

 public:
  void addValue(int pos, int val) {
    addValueRec(STARTINDEX, ENDINDEX, pos, val, 0);
  }

 public:
  void addValueRec(int low, int high, int pos, int val, int p) {
    if (low <= pos && pos <= high) {
      tree[p] = tree[p] + val;
      if (low != high) {
        int mid = (low + high) / 2;
        addValueRec(low, mid, pos, val, leftChild(p));
        addValueRec(mid + 1, high, pos, val, rightChild(p));
      }
    }
  }

 public:
  void print() { print_vector(tree); }
};
class FenwickTree {
 private:
  vector<int> ft;

 public:
  FenwickTree(int n) { ft.assign(n + 1, 0); }
  int rsq(int b) {
    int sum = 0;
    for (; b; b -= b & (-b)) sum += ft[b];
    return sum;
  }
  int rsq(int a, int b) { return rsq(b) - (a == 1 ? 0 : rsq(a - 1)); }
  void adjust(int k, int v) {
    for (; k < (int)ft.size(); k += k &= (-k)) ft[k] += v;
  }
  void print() { print_vector(ft); }
};
struct Graph {
  int V, E;
  vector<pair<int, pair<int, int>>> edges;
  Graph(int a, int b) {
    V = a;
    E = b;
  }
  void addEdge(int a, int b, int w) { edges.push_back({w, {a, b}}); }
  vector<int> links, sizes;
  int find(int a) {
    if (a == links[a]) return a;
    return links[a] = find(links[a]);
  }
  bool same(int a, int b) { return find(a) == find(b); }
  void unite(int a, int b) {
    a = find(a);
    b = find(b);
    if (sizes[a] < sizes[b]) swap(a, b);
    sizes[a] += sizes[b];
    links[b] = a;
  }
  void sort_edges() { sort(edges.begin(), edges.end()); }
  long long kruskalMST() {
    sort_edges();
    links.resize(V);
    sizes.resize(V);
    for (int i = 0; i < V; i++) {
      links[i] = i;
      sizes[i] = 1;
    }
    long long sum = 0;
    int count = 0;
    for (int i = (0); i < (E); ++i) {
      int start = edges[i].second.first;
      int end = edges[i].second.second;
      if (!same(start, end)) {
        unite(start, end);
        sum += edges[i].first;
        count++;
      }
    }
    if (count != V - 1) return -998244353;
    return sum;
  }
};
int modInverse(int a, int m) {
  int m0 = m;
  int y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    int q = a / m;
    int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long power(long long number, int power, int mod) {
  long long ans = 1;
  while (number) {
    if (((number - 1) & 1) == 0) {
      ans *= power;
      ans %= mod;
      ans *= ans;
      ans %= mod;
      number--;
      number <<= 1;
    } else {
      ans *= ans;
      ans %= mod;
      number <<= 1;
    }
  }
  return ans;
}
long long a, b, c;
void init() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
}
int n, k;
vector<int> numbers;
bool is_possible1(int value) {
  a = 0;
  int i;
  for (i = 0; i < n; i++) {
    if (numbers[i] <= value) {
      i++;
      a++;
    }
  }
  if (k % 2 == 0 && i > n && numbers[0] <= value) a--;
  return a >= (k + 1) / 2;
}
bool is_possible2(int value) {
  a = 0;
  int i;
  for (i = 1; i < n; i++) {
    if (numbers[i] <= value) {
      i++;
      a++;
    }
  }
  if (i > n && k % 2 == 1) a--;
  return a >= k / 2;
}
bool is_possible(int value) {
  return is_possible1(value) || is_possible2(value);
}
int main() {
  init();
  cin >> n >> k;
  numbers.resize(n);
  for (int i = (0); i < (n); ++i) cin >> numbers[i];
  int min = 1;
  int max = 1000000000;
  while (min < max) {
    int mid = (min + max) / 2;
    if (is_possible(mid))
      max = mid;
    else
      min = mid + 1;
  }
  cout << min << '\n';
}
