func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     int n, k;     cin >> n >> k;     int t[n];     for (int i = 0; i < n; i++) cin >> t[i];     sort(t, t + n);     if (k == n)       cout << t[n - 1] << endl;     else if (k == 0) {       if (t[0] - 1 == 0)         cout << -1 << endl;       else         cout << t[0] - 1 << endl;     } else if (k == 1) {       if (t[0] == t[1])         cout << -1 << endl;       else         cout << t[0] << endl;     } else if (t[k - 1] == t[k])       cout << -1 << endl;     else       cout << t[k - 1] << endl;   }   