# ARC086C - Not so Diverse

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

lst = sorted(list(map(int, input().rstrip().split())))

dic = {}

for i in lst:

    if i not in dic:

        dic[i] = 1

    else:

        dic[i] += 1



cnt = sorted([i for i in list(dic.values())], reverse=True)

ans = 0

for i in range(len(cnt)):

    if k > 0:

        k -= 1

        continue

    ans += cnt[i]

print(ans)
# ARC086C - Not so Diverse (ABC081C)

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

lst = sorted(list(map(int, input().rstrip().split())))

dic = {}

for i in lst:

    if i not in dic:

        dic[i] = 1

    else:

        dic[i] += 1



cnt = sorted([i for i in list(dic.values())], reverse=True)

print((n - sum(cnt[:k])))
# ARC086C - Not so Diverse
n, k = list(map(int, input().rstrip().split()))
lst = sorted(list(map(int, input().rstrip().split())))
dic = {}
for i in lst:
    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1
cnt = sorted([i for i in list(dic.values())], reverse=True)
ans = 0
for i in range(len(cnt)):
    if k > 0:
        k -= 1
        continue
    ans += cnt[i]
print(ans)

# ARC086C - Not so Diverse (ABC081C)
n, k = list(map(int, input().rstrip().split()))
lst = sorted(list(map(int, input().rstrip().split())))
dic = {}
for i in lst:
    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1
cnt = sorted([i for i in list(dic.values())], reverse=True)
print((n - sum(cnt[:k])))

-# ARC086C - Not so Diverse +# ARC086C - Not so Diverse (ABC081C) -ans = 0 -for i in range(len(cnt)): -    if k > 0: -        k -= 1 -        continue -    ans += cnt[i] -print(ans) +print((n - sum(cnt[:k])))