import collections
n, k = map(int, input().split())
list = input().split()
c_list = collections.Counter(list)
sorted_c_list = sorted(c_list.values(), reverse=True)
print(sum(sorted_c_list[k:]))

037623dca2c0329751557d4a8c15a6d165a9dd39
<mask token>

<mask token>
print(sum(sorted_c_list[k:]))

<mask token>
n, k = map(int, input().split())
list = input().split()
c_list = collections.Counter(list)
sorted_c_list = sorted(c_list.values(), reverse=True)
print(sum(sorted_c_list[k:]))

import collections
n, k = map(int, input().split())
list = input().split()
c_list = collections.Counter(list)
sorted_c_list = sorted(c_list.values(), reverse=True)
print(sum(sorted_c_list[k:]))
