1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <bits/stdc++.h>
#include <iostream>

using namespace std;
int n, k;
int a[121];
int s;
int res;
int main() {
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> s;
        a[s]++;
    }
    for (int i = 120; i >= 1; i--) {
        res += a[i];
        if (res >= k) {
            cout << res << endl;
            break;
        }
    }
            return 0;
}