import collections N,K = map(int, input().split()) A = list(map(int, input().split())) CA = collections.Counter(A) L = [] for k in CA.values(): L.append(k) sorted(L,reverse=True) ans = 0 for i,l in enumerate(L): K-=l if K<=0: print(i+1) exit()