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

int results[2001];
int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>results[i];
    }

    sort(results, results+n);
    k=n-k;
    while(k>0 and results[k-1]==results[k])
        k--;
    cout<<n-k<<endl;
}