1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <bits/stdc++.h>
using namespace std;
int main(){
    vector<int>wyn;
    int a,b,x,ind,odp,pl;
    cin>>a;
    cin>>b;
    while(a>0){
        cin>>x;
        wyn.push_back(x);
        a--;
    }
    odp=b;
    sort(wyn.rbegin(),wyn.rend());
    ind=wyn[b-1];
    pl=b-1;
    while(ind==wyn[pl]){
        odp++;
        pl++;

    }
    cout<<odp-1;
    return 0;
}