def sort_first_k(iterable, k):
    lst = [sys.maxsize]
max_ = sys.maxsize, 0
for el in iterable:
    if el < max_[0]:
        lst.append(el)
if len(lst) > k:
    lst.pop(max_[1])
Is there a way to sort a list in python until the first sorted k elements are found?