1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <vector>

using namespace std;

int main() {
	std::ios_base::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	vector<int> a(120);
	for (int i = 0; i < n; i++) {
		int v;
		cin >> v;
		a[120 - v]++;
	}
	int allocated = 0, current_a = 0;
	while (allocated < k) allocated += a[current_a++];
	cout << allocated << endl;
	return 0;
}