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

vector<int> points;

int main() 
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int number, min;
    cin >> number >> min;
    points.resize(number);
    for(int i = 0; i < number; i++)
    {
        cin >> points[i];
        points[i]*=-1;
    }
    sort(points.begin(), points.end());
    cout << upper_bound(points.begin()+min, points.end(), points[min-1])-points.begin();
}