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
33
34
// #include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <iostream>
#include <vector>
#include <set>
using namespace std;

int main()
{
    FAST int n, k, tmp;
    cin >> n >> k;
    if (k == n)
    {
        cout << k << endl;
        return 0;
    }

    vector<int> pointz(121, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> tmp;
        pointz[tmp]++;
    }
    int total = 0;
    for (int i = 120; i >= 0; i--)
    {
        total += pointz[i];
        if (total >= k)
        {
            cout << total << endl;
            return 0;
        }
    }
}