1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include<bits/stdc++.h>
using namespace std;

int n,k,a[2004],w;

int main()
{
    cin>>n>>k;
    w = k - 1;
    for(int i = 0;i < n; i++)
        cin>>a[i];
    sort(a,a + n);
    reverse(a,a + n);
    while(a[w] == a[w + 1]) w++;
    cout<<w + 1<<'\n';
    return 0;
}