1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include <bits/stdc++.h>
using namespace std;

int main() 
{
	ios_base::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	vector <int> A(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
		A[i] *= -1;
	}
	sort(A.begin(), A.end());
	cout << (lower_bound(A.begin(), A.end(), A[k-1]+1) - A.begin()) <<endl;
}