from collections import Counter n, k = map(int, input().split()) A = list(map(int, input().split())) counter = Counter(A) C = [cnt for cnt in counter.values()] C.sort(reverse=True) ans = 0 res = 0 for i in range(n): res += C[i] ans += 1 if res >= k: break print(ans)