1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
	
using namespace std;

bool compare(int i, int j) {return i > j;}

int main() {
	int n, k, t, res;	
	cin >> n >> k;
	vector<int> v(120, 0);
	res = 0;
	for(int i = 0; i < n; i++){
		cin >> t;
		v[t-1]++;
	}
	for(int i = v.size() - 1; i >= 0 && res < k; i--){
		res += v[i];
	}
	cout << res << endl;
}