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

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

from collections import Counter as co

var=co(l).most_common()

en=len(var)

ans=0

while en>k :

    ans+=var[en-1][1]

    en-=1

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

from collections import Counter as co

var=sorted(list(co(list(map(int,input().split()))).values()),reverse=1)

print((sum(var[k:])))

n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
from collections import Counter as co

var = co(l).most_common()
en = len(var)
ans = 0
while en > k:
    ans += var[en - 1][1]
    en -= 1
print(ans)

n, k = list(map(int, input().split()))
from collections import Counter as co

var = sorted(list(co(list(map(int, input().split()))).values()), reverse=1)
print((sum(var[k:])))

-l = list(map(int, input().split())) -var = co(l).most_common() -en = len(var) -ans = 0 -while en > k: -    ans += var[en - 1][1] -    en -= 1 -print(ans) +var = sorted(list(co(list(map(int, input().split()))).values()), reverse=1) +print((sum(var[k:])))