1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <algorithm>
using namespace std;

/*

5 5
75 90 120 75 40
 */

int main() {
    int n,k;
    cin >> n >> k;
    int i;
    int arr[n];
    for(i=0;i<n;i++) {
        cin >> arr[i];
    }

    sort(arr, arr + n);

    int minPoints = arr[n - k];
    int result = k;
    for (i = n - k - 1; i >= 0; i--) {
        if (arr[i] == minPoints) {
            result++;
        } else {
            break;
        }
    }
    std::cout << result << std::endl;


    return 0;
}