import collections N,K=map(lambda x: int(x), input().split()) ct = 0 tmp = 0 for p in collections.Counter(list(map(lambda x: int(x), input().split()))).most_common(): ct+=1 tmp += p[1] if tmp >= K: break print(ct)