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

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



numAppeared = [0] * (N+1)



for i in A:

    numAppeared[i] += 1



numAppeared.sort( reverse=True )



print(( sum( numAppeared[i] for i in range(K,N) ) ))
N, K = list(map( int, input().split() ))

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



numAppeared = [0] * (N+1)



for i in A:

    numAppeared[i] += 1



numAppeared.sort( reverse=True )



# print( sum( numAppeared[i] for i in range(K,N) ) )

print(( sum( numAppeared[K:N] ) ))
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
numAppeared = [0] * (N + 1)
for i in A:
    numAppeared[i] += 1
numAppeared.sort(reverse=True)
print((sum(numAppeared[i] for i in range(K, N))))

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
numAppeared = [0] * (N + 1)
for i in A:
    numAppeared[i] += 1
numAppeared.sort(reverse=True)
# print( sum( numAppeared[i] for i in range(K,N) ) )
print((sum(numAppeared[K:N])))

-print((sum(numAppeared[i] for i in range(K, N)))) +# print( sum( numAppeared[i] for i in range(K,N) ) ) +print((sum(numAppeared[K:N])))