from collections import Counter

N,K = list(map(int,input().split()))

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

ctr = Counter(src)



ans = 0

kind = len(ctr)

for k,v in reversed(ctr.most_common()):

    if kind <= K:

        break

    ans += v

    kind -= 1

print(ans)

from collections import Counter

N,K = list(map(int,input().split()))

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

ctr = Counter(src)



ans = N

for k,v in ctr.most_common(K):

    ans -= v

print(ans)
from collections import Counter

N, K = list(map(int, input().split()))
src = list(map(int, input().split()))
ctr = Counter(src)
ans = 0
kind = len(ctr)
for k, v in reversed(ctr.most_common()):
    if kind <= K:
        break
    ans += v
    kind -= 1
print(ans)

from collections import Counter

N, K = list(map(int, input().split()))
src = list(map(int, input().split()))
ctr = Counter(src)
ans = N
for k, v in ctr.most_common(K):
    ans -= v
print(ans)

-ans = 0 -kind = len(ctr) -for k, v in reversed(ctr.most_common()): -    if kind <= K: -        break -    ans += v -    kind -= 1 +ans = N +for k, v in ctr.most_common(K): +    ans -= v