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

#define N 2000
int n, k, zaw[N+7];

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> zaw[i];
    sort(zaw, zaw+n, greater<int>());
    int j = k;
    while (zaw[j] == zaw[k-1]) j++;
    cout << j << "\n";
    return 0;
}