import itertools n, k = map(int, input().split()) A = list(map(int, input().split())) A.sort() B = [] for _, g in itertools.groupby(A): B.append(len(list(g))) B.sort() cnt = 0 while k > 0: cnt += 1 k -= B.pop() print(cnt)