from collections import defaultdict N, K = map(int, input().split()) A = list(map(int, input().split())) d = defaultdict(int) for i in A: d[i] += 1 t = sorted([(j, i) for i, j in d.items()], reverse=True) ans = 0 for j, i in t: K -= j ans += 1 if K <= 0: break print(ans)