I,R=input,range def J(): return map(int,I().split()) N,K=J() A=list(J()) B=[0]*(N+1) for a in A:B[a]+=1 a=0 for b in sorted(B,reverse=True): a+=1 K-=b if K<1:break print(a)