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

using namespace std;
vector<int> pts;

int main()
{
    int n,k;
    scanf("%d%d",&n, &k);
    pts.resize(n);
    for(int i=0;i<n;i++) scanf("%d", &pts[i]);
    sort(pts.begin(), pts.end());
    reverse(pts.begin(), pts.end());
    int res = k;
    while (res < n && pts[res] == pts[k-1]) res++;
    cout << res << endl;

}