1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#include <algorithm>
#include <iostream>
using namespace std;
int arr[2064];

int main(){
    int n, k;
    scanf("%d%d", &n, &k);
    for(int i=0;i<n;++i){
        scanf("%d", &arr[i]);
    }
    sort(arr, arr+n);
    reverse(arr, arr+n);
    int i=k;
    while(arr[i]==arr[k-1]){
        ++i;
    }
    printf("%d", i);
    return 0;
}