#include <bits/stdc++.h>
int findmax(int *a, int s, int n);
void mergsort(long long int a[], long long int t[], int size, int n);
void merg(long long int a[], long long int t[], int l1, int u1, int l2, int u2);
void copy(long long int a[], long long int t[], int n);
long long int min(long long int a, long long int b) {
  if (a < b)
    return (a);
  else
    return (b);
}
long long int max(long long int a, long long int b) {
  if (a > b)
    return (a);
  else
    return (b);
}
long long int mod(long long int a) {
  if (a < 0)
    return (-a);
  else
    return (a);
}
long long int p = 1000000007;
long long int fre(long long int a, long long int m) {
  if (a < m) return (0);
  if (a == m) return (1);
  long long int j, mul = 1;
  for (j = (a - m + 1); j <= a; j++) {
    mul = ((mul * j) % p);
  }
  a = mul;
  long long int power = p - 2;
  mul = 1;
  for (j = 1; j <= m; j++) {
    mul = ((mul * j) % p);
  }
  m = mul;
  while (power > 0) {
    if (power % 2 == 0) {
      power /= 2;
      m = ((m * m) % p);
      continue;
    } else {
      power--;
      a = ((a * m) % p);
    }
  }
  if (a < 0) a = a + p;
  return (a);
}
int gcd(int a, int b) {
  if (b % a == 0) {
    return (a);
  } else
    gcd(b % a, a);
}
int solve(long long int tar, long long int *x, int k, int n) {
  int j = 0, count = 0;
  for (j = 0; j < n; j++) {
    if (count % 2 == 0) {
      if (x[j] <= tar) count++;
    } else {
      count++;
    }
  }
  if (count >= k) return (1);
  count = 0;
  for (j = 0; j < n; j++) {
    if (count % 2 == 1) {
      if (x[j] <= tar) count++;
    } else {
      count++;
    }
  }
  if (count >= k)
    return (1);
  else
    return (0);
}
long long int binary_search(long long int l, long long int r, long long int *x,
                            int k, int n) {
  long long int mid, ans = -1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (solve(mid, x, k, n)) {
      r = mid - 1;
      ans = mid;
    } else {
      l = mid + 1;
    }
  }
  return (ans);
}
long long int my_pow(long long int a, long long int power) {
  long long int mul = 1;
  while (power != 0) {
    if (power % 2 == 0) {
      power /= 2;
      a = (a * a) % p;
    } else {
      power--;
      mul = (mul * a) % p;
    }
  }
  return (mul);
}
int sieve[1000001];
void sieve_of_eratosthenes() {
  int j;
  for (j = 0; j <= 1000000; j++) sieve[j] = 0;
  j = 2;
  for (j = 2; j * j <= 1000000; j++) {
    if (sieve[j] == 0) {
      int k;
      for (k = j * j; k <= 1000000; k += j) {
        sieve[k] = 1;
      }
    }
  }
}
long long int po[1000001];
void f() {
  po[0] = 1;
  int j;
  for (j = 1; j <= 1000000; j++) {
    po[j] = 1;
    po[j] = (po[j - 1] * 2) % p;
  }
}
long long int fac[2000001];
void fact() {
  long long int j;
  fac[0] = 1;
  for (j = 1; j <= 2000000; j++) {
    fac[j] = 1;
    fac[j] = (fac[j - 1] * j) % p;
  }
}
long long int bet[2000001];
void calcofbet() {
  long long int j;
  for (j = 0; j <= 2000000; j++) {
    bet[j] = my_pow(fac[j], p - 2);
  }
}
long long int biggestprimedivisor[1000001];
long long int myceil(long long int a, long long int b) {
  if (a % b == 0)
    return (a / b);
  else
    return ((a / b) + 1);
}
long long int myfloor(long long int a, long long int b) {
  if (a % b == 0) return (a / b);
  return (a / b);
}
int check(int *a, int n) {
  int j, u = 0;
  for (j = 0; j < n - 1; j++) {
    if (a[j] <= a[j + 1]) {
      u++;
    } else
      break;
  }
  if (u == n - 1)
    return (1);
  else
    return (0);
}
int main() {
  int q;
  q = 1;
  while (q--) {
    int n, k, j;
    scanf("%d %d", &n, &k);
    long long int a[n];
    for (j = 0; j < n; j++) scanf("%lld", (a + j));
    { printf("%lld\n", binary_search(1, 1000000001, a, k, n)); }
  }
  return 0;
}
void mergsort(long long int a[], long long int t[], int size, int n) {
  int l1 = 0, l2, u1, u2;
  u1 = l1 + size - 1;
  l2 = u1 + 1;
  u2 = l2 + size - 1;
  if (u2 >= n - 1) u2 = n - 1;
  while (u1 < n - 1) {
    if (u2 >= n - 1) u2 = n - 1;
    merg(a, t, l1, u1, l2, u2);
    l1 = u2 + 1;
    u1 = l1 + size - 1;
    l2 = u1 + 1;
    u2 = l2 + size - 1;
  }
  copy(a, t, n);
}
void merg(long long int a[], long long int t[], int l1, int u1, int l2,
          int u2) {
  int i = l1, j = l2, k = l1;
  while ((i <= u1) && (j <= u2)) {
    if (a[i] <= a[j]) {
      t[k] = a[i];
      i++;
      k++;
      continue;
    } else if (a[j] < a[i]) {
      t[k] = a[j];
      k++;
      j++;
    }
  }
  while (i <= u1) {
    t[k] = a[i];
    k++;
    i++;
  }
  while (j <= u2) {
    t[k] = a[j];
    k++;
    j++;
  }
}
void copy(long long int a[], long long int t[], int n) {
  int j;
  for (j = 0; j < n; j++) {
    a[j] = t[j];
  }
}
