#yukicoder391A ''' やばい回に紛れ込んでしまった 助かるかな ''' f=lambda:list(map(int,input().split())) from collections import defaultdict as dd N,K=f(); A=f(); D=dd(int) for i in A: D[i]+=1 num=[] for i in D: num.append(D[i]) num.sort(reverse=True) ans=0; cnt=0 for i in num: ans+=1; cnt+=i if cnt>=K: print(ans); break