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

using namespace std;

int main() {
    int n, k;
//    vector<uint8_t> points;
    array<int, 130> people_with_score;
    people_with_score.fill(0);

    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; ++i) {
        int now;
        scanf("%d", &now);
//        points.push_back(now);
        people_with_score[now]++;
    }

    int shirts_given = 0;
    int score_given = 125;
    while (shirts_given < k) {
//        printf("now: %d, %d\n", shirts_given, score_given);
        score_given--;
        shirts_given += people_with_score[score_given];
    }
    printf("%d\n", shirts_given);
    return 0;
}