import collections n,k=map(int,input().split()) a=list(map(int,input().split())) c=collections.Counter(a) b=list(c.values()) b.sort(reverse=True) x=0 for i in range(len(b)): x+=b[i] if x>=k: print(i+1) break