1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <cstdio>
#include <algorithm>
#define MAKS 2010
using namespace std;
int tab[MAKS];
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++)scanf("%d",&tab[i]);
    sort(tab,tab+n,greater<int>());
    int p=k;
    while(p<n && tab[p]==tab[k-1])p++;
    printf("%d\n",p);
}