from collections import Counter
n, k = map(int, input().split())
a = list(map(int, input().split()))
c = Counter(a)
x = sorted(c.items(), key=lambda x:x[1])
t = 0
ans = 0
for a, b in x:
    ans += 1
    t += b
    if t >= k:
        print(ans)
        break