"""
출처:프로그래머스,
https://school.programmers.co.kr/learn/courses/30/lessons/138476
"""
#풀이과정
def solution(k, tangerine):
count = {}
for x in tangerine:
if not str(x) in count:
count[str(x)] = 1
else:
count[str(x)] += 1
count = sorted(count.items(), key=lambda x: -x[1])
result = []
for y, z in count:
if k > 0:
result.append(y)
k -= z
else:
break
return len(result)