import collections



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

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





a = collections.Counter(a)



a = a.most_common()

if k<len(a):

	x = 0

	for i in range(k,len(a)):

		x += a[i][1]



	print(x)

else:

	print((0))

import collections



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

a = list(input().split())





a = collections.Counter(a)



a = a.most_common()

if k<len(a):

	x = 0

	for i in range(k,len(a)):

		x += a[i][1]



	print(x)

else:

	print((0))

import collections

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = collections.Counter(a)
a = a.most_common()
if k < len(a):
    x = 0
    for i in range(k, len(a)):
        x += a[i][1]
    print(x)
else:
    print((0))

import collections

n, k = list(map(int, input().split()))
a = list(input().split())
a = collections.Counter(a)
a = a.most_common()
if k < len(a):
    x = 0
    for i in range(k, len(a)):
        x += a[i][1]
    print(x)
else:
    print((0))

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