from collections import Counter n,k = map(int,input().split()) a = Counter(map(int,input().split())) ans = 0 for v in sorted(a.values())[::-1]: ans += 1; k -= v if k<=0: break print(ans)