#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     int *arr = new int[n];     for (int i = 0; i < n; i++) cin >> arr[i];     sort(arr, arr + n);     reverse(arr, arr + n);     cout << arr[k - 1];     return 0;   }   