n, k = int(eval(input())), int(eval(input()))
num = sorted([int(eval(input())) for i in range(0, n)])
min_unfairness = min(max_value - min_value for min_value, max_value in zip(
    num, num[k - 1:]))
Performance Improvement Basics in Python