from collections import Counter from itertools import accumulate N,K = list(map(int,input().split())) A = list(map(int,input().split())) ca = Counter(A) s = sorted(ca.values(),reverse=True) S = [0] + list(accumulate(s)) + [10**18] for i in range(len(S)): if(S[i] >= K): print(i) exit()