n , k = map(int, input().split(" ")) temp_list = input().split(" ") temp_list = list(map(int, temp_list)) for i in sorted(temp_list,reverse=False)[0:k]: print(i, end=" ")