1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <bits/stdc++.h>
using namespace std;
int n, k, t[2003];
int main()
{
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &t[i]);
    }
    sort(t, t + n, greater < int > ());
    while(t[k] == t[k - 1])
        ++k;
    printf("%d", k);
}