N, K = map(int, input().split()) A = list(map(int, input().split())) B = [0] * (N + 1) for a in A: B[a] += 1 a = 0 for b in sorted(B, reverse=True): a += 1 K -= b if K<1: break print(a)