N,K = map(int,input().split()) A = list(map(int,input().split())) from collections import Counter A_count = Counter(A) A_count_sorted = sorted(A_count.items(),key = lambda x:x[1],reverse=True) i = 0 while K >= 1: K -= A_count_sorted[i][1] i += 1 print(i)