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
#include <cstdio>
#include <array>
#include <cstdint>

std::array<uint16_t, 121> array;

int main(int argc, char** argv) {
    uint16_t n, k, x;
    std::scanf("%hd %hd", &n, &k);

    while(std::scanf("%hd", &x) != EOF) {
        ++array[x];
    }

    uint16_t count = 0;

    for(auto iter = array.crbegin(); iter != array.crend(); ++iter) {
        count += *iter;

        if(count >= k) {
            break;
        }
    }

    std::printf("%d\n", count);

    return 0;
}