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

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



from collections import Counter

c = Counter(a)

cnts = []

for i, j in list(c.items()):

  cnts.append(j)



print((sum(sorted(cnts)[:-k])))
from collections import Counter

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

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

cnts = list(Counter(a).values())

print((sum(sorted(cnts)[:-k])))
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
from collections import Counter

c = Counter(a)
cnts = []
for i, j in list(c.items()):
    cnts.append(j)
print((sum(sorted(cnts)[:-k])))

from collections import Counter

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnts = list(Counter(a).values())
print((sum(sorted(cnts)[:-k])))

+from collections import Counter + -from collections import Counter - -c = Counter(a) -cnts = [] -for i, j in list(c.items()): -    cnts.append(j) +cnts = list(Counter(a).values())