1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n,k,temp;
    cin>>n>>k;
    vector<int> tshirts;
    for (int i = 0; i < n; i++)
    {
        cin>>temp;
        tshirts.push_back(temp);
    }
    sort(tshirts.begin(),tshirts.end(), greater<int>());
    int last=tshirts[k-1];
    for (int i = k; i < n; i++)
    {
        if(tshirts[i]==tshirts[i-1])
            k++;
        else
            break;
    }
    cout<<k<<endl;
    return 0;
}