1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> kos(n);
	for (int i = 0; i < n; i++) cin >> kos[i];
	sort<>(kos.begin(), kos.end(), greater<int>());
	while (k < n && kos[k] == kos[k - 1]) k++;
	cout << k;
}