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
/* 2021
 * Maciej Szeptuch
 */

#include <cstdio>

int contestants;
int count[128];
int minShirts;
int score;
int shirts;

int main(void)
{
    scanf("%d %d", &contestants, &minShirts);
    for(int c = 0; c < contestants; ++c)
    {
        scanf("%d", &score);
        ++count[score];
    }

    for(int s = 120; s >= 0 && shirts < minShirts; --s)
        shirts += count[s];

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