1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <bits/stdc++.h>

int main()
{
    using namespace std;
    int n, k;
    cin >> n >> k;
    vector<int> score(n);
    for(int i=0; i<n; ++i)
    {
        cin >> score[i];
        score[i] = -score[i];
    }


    sort(score.begin(), score.end());
    int v = score[k-1];
    auto it = std::equal_range(score.begin(), score.end(), v);
    cout << (it.second - score.begin()) << endl;
    return 0;
}