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

int main() {
	int t[2006] = {};
	int n;
	int k;
	int wyn;
	cin >> n;
	cin >> k;
	wyn = k;
	for (int i = 0; i < n; i++) { // co to robi????:?????
		cin >> t[i];
	}
	sort(t, t+n);
	for (int i = n-k-1; i >= 0; i--) {
		if (t[n-k] == t[i]) {
			wyn++;
		}
	}
	cout << wyn;
}