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 <cstdio>

int main()
{
int N,n,K,k,Z[121],R,v;

	scanf("%d %d",&N,&K);
	
	for (n = 0; n < 121; n++) Z[n] = 0;
	for (n = 0; n < N; n++)
	{
		scanf("%d",&v);
		Z[v]++;
	}
	R = 0;
	n = 120;
	while (n >= 0 && R < K)
	{
		R += Z[n];
		n--;
	}
	
	printf("%d\n",R);
	
	return 0;
}