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 <bits/stdc++.h>

using namespace std;

const int N = int(3e5) + 99;

const int SIZE = 121;
int n, x, k;
int a[SIZE];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> k;

    for (int i = 0; i <n; i++) {
        cin >> x;
        a[x]++;
    }
    int sum = 0;
    for (int i = SIZE-1; i >= 0; i--) {
        if (k <= 0) break;
        sum += a[i];
        k -= a[i];
    }

    cout << sum << endl;
}