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 main(){
	ios_base::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	int t[n+7];
	for(int i = 0; i < n; ++i){
		cin >> t[i];
		t[i]*=-1;
	}
	sort(t,t+n);
//	for (int i = 0; i < n; ++i)cout << t[i] << " "; cout << "\n";

	while(k<n && t[k]==t[k-1])++k;
	cout << k << "\n";
	return 0;
}