1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <bits/stdc++.h>

using namespace std;

int shirts[2001];

int main() {
    int n, k;
    cin >> n >> k;

    for(int i = 0; i < n; i++) scanf("%d", shirts + i);

    sort(shirts, shirts + n, greater<int>());

    shirts[n] = -1;
    k--;

    while(k < n && shirts[k] == shirts[k + 1]) k++;

    cout << (k + 1) << endl;

    return 0;
}