import sys input = sys.stdin.readline N, K = map(int, input().split()) A = list(map(int, input().split())) cnt = [0]*(N+1) for x in A: cnt[x] += 1 cnt.sort(reverse=True) ans = 0 for x in cnt: K -= x ans += 1 if K <= 0: break print(ans)