from collections import Counter N, K = map(int, input().split()) A = list(map(int, input().split())) cnt = Counter(A) n = 0 ans = 0 for k, v in sorted(cnt.items(), reverse=True, key=lambda x: x[1]): n += v ans += 1 if n >= K: break print(ans)