Takahashi has N balls. Initially, an integer A_i is written on the i-th ball.  He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.  Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
# arc086_a.py
import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))
C = collections.Counter(A)
C = sorted(C.values())

lenght = len(C)
print(lenght, K, C)
print(sum(C[:(lenght-K)]))

# arc086_a.py
import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))
C = collections.Counter(A)
C = sorted(C.values())

lenght = len(C)
# print(lenght, K, C)
print(sum(C[:(lenght-K)]))
