from collections import Counter
n,k = map(int,input().split())

C = Counter(list(map(int,input().split())))

values = list(C.values())
values.sort()

ans = 0
for v in values[::-1]:
	k -= v
	ans += 1
	if k <= 0:
		print(ans)
		exit()