def solution(k, score):
l = len(score)
l_h = []
p_s = []
for i in range(l):
if i == 0:
l_h.append(score[i])
else:
if i < k:
l_h.append(score[i])
l_h.sort()
else:
if l_h[0] < score[i]:
l_h.append(score[i])
l_h = l_h[1:]
l_h.sort()
p_s.append(l_h[0])
answer = p_s
return answer