#include <bits/stdc++.h>
using namespace std;
int INF = 1000000001;
vector<int> a;
void writeln(int a) { printf("%d\n", a); }
void writeln(int a, int b) { printf("%d %d\n", a, b); }
void writeln(int a, int b, int c) { printf("%d %d %d\n", a, b, c); }
void writeln(int a, int b, int c, int d) {
  printf("%d %d %d %d\n", a, b, c, d);
}
void write(int a) { printf("%d", a); }
void write(int a, int b) { printf("%d %d", a, b); }
void write(int a, int b, int c) { printf("%d %d %d", a, b, c); }
void write(int a, int b, int c, int d) { printf("%d %d %d %d", a, b, c, d); }
void read(int &a) { scanf("%d", &a); }
void read(int &a, int &b) { scanf("%d %d", &a, &b); }
void read(int &a, int &b, int &c) { scanf("%d %d %d", &a, &b, &c); }
void read(int &a, int &b, int &c, int &d) {
  scanf("%d %d %d %d", &a, &b, &c, &d);
}
void readln(int &a) { scanf("%d\n", &a); }
void readln(int &a, int &b) { scanf("%d %d\n", &a, &b); }
void readln(int &a, int &b, int &c) { scanf("%d %d %d\n", &a, &b, &c); }
void readln(int &a, int &b, int &c, int &d) {
  scanf("%d %d %d %d\n", &a, &b, &c, &d);
}
void writeln(vector<int> a) {
  for (int i = 0; i < a.size(); i++)
    printf("%d%c", a[i], i == a.size() - 1 ? '\n' : ' ');
}
void readln(vector<int> &a, int n) {
  int x;
  for (int i = 1; i <= n; i++) read(x), a.push_back(x);
}
int main() {
  int n, m, k;
  readln(n, k);
  readln(a, n);
  sort(a.begin(), a.begin() + n);
  if (n < k) {
    printf("-1");
    return 0;
  }
  writeln(a[n - k], 0);
  return 0;
}
