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

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



num = [0]*2000001



for i in range(N):

    num[A[i]] +=1



V = 2000001 - num.count(0)



if V <=K:

    print((0))

else:

    num.sort()

    num.reverse()

    print((sum(num[K:])))
N,K = list(map(int,input().split()))

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



num = [0]*(N+1)



for i in range(N):

    num[A[i]] +=1



V = N+1 - num.count(0)



if V <=K:

    print((0))

else:

    num.sort()

    num.reverse()

    print((sum(num[K:])))
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
num = [0] * 2000001
for i in range(N):
    num[A[i]] += 1
V = 2000001 - num.count(0)
if V <= K:
    print((0))
else:
    num.sort()
    num.reverse()
    print((sum(num[K:])))

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
num = [0] * (N + 1)
for i in range(N):
    num[A[i]] += 1
V = N + 1 - num.count(0)
if V <= K:
    print((0))
else:
    num.sort()
    num.reverse()
    print((sum(num[K:])))

-num = [0] * 2000001 +num = [0] * (N + 1) -V = 2000001 - num.count(0) +V = N + 1 - num.count(0)