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
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
	int members_num, rewards;
	std::cin >> members_num >> rewards;
	std::vector<int> pts;
	
	for (int i = 0; i < members_num; i++)
	{
		int temp;
		std::cin >> temp;
		pts.emplace_back(temp);
	}

	std::sort(pts.begin(), pts.end(), std::greater<int>());
	
	int last = pts[rewards-1];

	for (int i = rewards; i < pts.size(); i++)
	{
		if (last != pts[i])
		{
			break;
		}

		rewards++;
	}

	std::cout << rewards;

	return 0;
}