Buggy python submission (verdict: Time Limit Exceeded):
k = [int(x) for x in input().split()][1]
num_list = [int(x) for x in input().split()]
num_dict = {}
for num in num_list:
    num_dict[num] = num_dict.get(num, 0) + 1
for i in range(0, k):
    if num_dict:
        num_dict.pop(max(num_dict, key=num_dict.get))
    else:
        print(0)
        break
else:
    print(sum(num_dict.values()))


Fixed submission:
[n, k] = [int(x) for x in input().split()]
num_list = [int(x) for x in input().split()]
num_dict = {}
for num in num_list:
    num_dict[num] = num_dict.get(num, 0) + 1
sorted_count = sorted(num_dict.values())
if len(sorted_count) - k > 0:
    print(sum(sorted_count[:len(sorted_count)-k]))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
[n, k] = [int(x) for x in input().split()]
num_list = [int(x) for x in input().split()]
num_dict = {}
for num in num_list:
    num_dict[num] = num_dict.get(num, 0) + 1
for i in range(0, k):
    if num_dict:
        num_dict.pop(max(num_dict, key=num_dict.get))
    else:
        print(0)
        break
else:
    print(sum(num_dict.values()))


Fixed submission:
[n, k] = [int(x) for x in input().split()]
num_list = [int(x) for x in input().split()]
num_dict = {}
for num in num_list:
    num_dict[num] = num_dict.get(num, 0) + 1
sorted_count = sorted(num_dict.values())
if len(sorted_count) - k > 0:
    print(sum(sorted_count[:len(sorted_count)-k]))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
[n, k] = [int(x) for x in input().split()]
num_list = [x for x in input().split()]
num_dict = {}
for num in num_list:
    num_dict[num] = num_dict.get(num, 0) + 1
for _ in range(0, k):
    if num_dict:
        num_dict.pop(max(num_dict, key=num_dict.get))
    else:
        print(0)
        break
else:
    print(sum(num_dict.values()))


Fixed submission:
[n, k] = [int(x) for x in input().split()]
num_list = [int(x) for x in input().split()]
num_dict = {}
for num in num_list:
    num_dict[num] = num_dict.get(num, 0) + 1
sorted_count = sorted(num_dict.values())
if len(sorted_count) - k > 0:
    print(sum(sorted_count[:len(sorted_count)-k]))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
[n, k] = [int(x) for x in input().split()]
num_list = [x for x in input().split()]
num_dict = {}
for num in num_list:
    num_dict[num] = num_dict.get(num, 0) + 1
for i in range(0, k):
    if num_dict:
        num_dict.pop(max(num_dict, key=num_dict.get))
    else:
        print(0)
        break
else:
    print(sum(num_dict.values()))


Fixed submission:
[n, k] = [int(x) for x in input().split()]
num_list = [int(x) for x in input().split()]
num_dict = {}
for num in num_list:
    num_dict[num] = num_dict.get(num, 0) + 1
sorted_count = sorted(num_dict.values())
if len(sorted_count) - k > 0:
    print(sum(sorted_count[:len(sorted_count)-k]))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
[n, k] = [int(x) for x in input().split()]
num_list = [x for x in input().split()]
for i in range(0, k):
    max_count, max_num = 0, ""
    for x in num_list:
        if num_list.count(x) > max_count:
            max_count = num_list.count(x)
            max_num = x
    else:
        num_list = [x for x in num_list if not x == max_num]
print(len(num_list))


Fixed submission:
[n, k] = [int(x) for x in input().split()]
num_list = [int(x) for x in input().split()]
num_dict = {}
for num in num_list:
    num_dict[num] = num_dict.get(num, 0) + 1
sorted_count = sorted(num_dict.values())
if len(sorted_count) - k > 0:
    print(sum(sorted_count[:len(sorted_count)-k]))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
[n, k] = [int(x) for x in input().split()]
num_list = [x for x in input().split()]
for i in range(0, k):
    max_count, max_num = 0, ""
    for x in num_list:
        if num_list.count(x) > max_count:
            max_count = num_list.count(x)
            max_num = x
    else:
        num_list = [x for x in num_list if not x == max_num]
print(len(num_list))


Fixed submission:
[n, k] = [int(x) for x in input().split()]
num_list = [int(x) for x in input().split()]
num_dict = {}
for num in num_list:
    num_dict[num] = num_dict.get(num, 0) + 1
sorted_count = sorted(num_dict.values())
if len(sorted_count) - k > 0:
    print(sum(sorted_count[:len(sorted_count)-k]))
else:
    print(0)