Takahashi has N balls. Initially, an integer A_i is written on the i-th ball.  He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.  Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
N, K = map(int, input().split())
A = list(map(int, input().split()))
d = {}
for i in set(A):
  d[i] = A.count(i)
ans = K
for i, (k, v) in enumerate(sorted(d.items())):
  if i < K -1:
    ans -= v

print(ans)
from collections import Counter

n, k = map(int, input().split())
a = list(map(int, input().split()))

c = Counter(a)

arr = c.most_common()[k:]

print(sum(x[1] for x in arr))
