N, K = map(int, input().split()) A = list(map(int, input().split())) from collections import Counter c = Counter(A) v = sorted(c.values(), reverse=True) ans = 0 s = 0 for i in range(len(v)): ans += 1 s += v[i] if s >= K: break print(ans)