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
#include <bits/stdc++.h>

using namespace std;

const int N = 2007;

int n, k;
int cnt[N];

int main() {
    scanf("%d %d", &n, &k);
    for (int i = 1; i <= n; ++i) {
        int v;
        scanf("%d", &v);
        cnt[v]++;
    }

    int ans = 0;
    for (int i = 120; i >= 1; --i) {
        ans += cnt[i];
        if (ans >= k)
            break;
    }

    printf("%d\n", ans);
    return 0;
}