1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <bits/stdc++.h>
using namespace std;

int n, k, zlicz[200], a, wyn;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        zlicz[a]++;
    }
    for (int i = 120; i >= 1; --i) {
        wyn += zlicz[i];
        if (wyn >= k) break;
    }
    cout << wyn << endl;
}