1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
// Krzysztof Baranski (2021.12.06)
#include <algorithm>
#include <cstdio>
using namespace std;

int points[2001];
int n, k;

int main() {
    scanf("%d %d\n", &n, &k);
    for(int i = 0; i < n; ++i) scanf("%d", &points[i]);
    sort(points, points+n);
    int result = n - (lower_bound(points, points+n, points[n-k])-points);
    printf("%d\n", result);
}