from collections import Counter n, k = map(int, input().split()) A = list(map(int, input().split())) ans = 0 for t, v in sorted(Counter(A).items(), key=lambda x:-x[1]): k -= v ans += 1 if k <= 0: break print(ans)