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