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

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

b = {}

for i in a:

    if i in b:

        b[i] += 1

    else:

        b[i] = 1

b = sorted(b.values())

print((sum(b[:-k])))
n, k = list(map(int, input().split()))

b = {}

for i in input().split():

    if i in b:

        b[i] += 1

    else:

        b[i] = 1

b = sorted(b.values())

print((sum(b[:-k])))
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = {}
for i in a:
    if i in b:
        b[i] += 1
    else:
        b[i] = 1
b = sorted(b.values())
print((sum(b[:-k])))

n, k = list(map(int, input().split()))
b = {}
for i in input().split():
    if i in b:
        b[i] += 1
    else:
        b[i] = 1
b = sorted(b.values())
print((sum(b[:-k])))

-a = list(map(int, input().split())) -for i in a: +for i in input().split():