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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <bits/stdc++.h>

using namespace std;


vector<int> tab;
int main()
{
    int k , n;
    cin >> k >> n;
    for (int i=0;i<k;++i)
    {
        int pom;
        cin >> pom;
        tab.push_back(pom);
    }
    sort(tab.begin() , tab.end(),greater<>());


    int w;

    for (int i=0;i<k;++i)
    {
        if (!(i < n or tab[i]==tab[i-1])) 
        break;

        w=i+1;
    }

    cout << w<<endl;
}

/*


5 3

75 90 120 75 40

*/