1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <vector>
#include <algorithm>
int k,n,a;
std::vector<int> sco;
int main(){
    std::ios_base::sync_with_stdio(0);
    std::cin>>n>>k;
    for(int i=0;i<n;i++){
        std::cin>>a;
        sco.emplace_back(a);
    }
    sort(sco.begin(),sco.end(),std::greater<int>());
    int i=k-1;
    while(i<n && sco[i]==sco[i+1])
        i++;
    std::cout<<i+1<<std::endl;

}