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
41
//==============
// Zadanie: Koszulki
// URL: https://sio2.mimuw.edu.pl/c/pa-2021-1/p/kos/
// Autor: Piotr Wieczorek
//==============
#include <bits/stdc++.h>

using namespace std;

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i) = 0; (i) <= (n); (i)++)
#define FOR(i, z, n) for (int (i) = (z); (i) < (n); (i)++)
#define FORE(i, z, n) for (int (i) = (z); (i) <= (n); (i)++)

//  ----------
//  SOLUTION
//  ----------
#define MAX_A 120

int n, k;
int kub[MAX_A+1];

void init() {
	scanf("%d%d", &n, &k);

	REPE(i, MAX_A) kub[i] = 0;
	REP(i, n) {
		int a;
		scanf("%d", &a);
		kub[a]++;
	}
}

int main() {
	init();
	int ans = 0;
	for (int i = MAX_A; i >= 0 && ans < k; i--) {
		ans += kub[i];
	}
	printf("%d\n", ans);
}