inputs = input() inputs_arr = inputs.split(" ") N = int(inputs_arr[0]) X = int(inputs_arr[1]) datas = [] for i in range(N): inputs = input() inputs_arr = inputs.split(" ") datas.append([int(inputs_arr[0]), int(inputs_arr[1])]) display_power = "" for i in range(X): max_power = 0 for j in range(N): position = datas[j][0] power = datas[j][1] position_len = abs((i + 1) - position) tmp_power = power - position_len if tmp_power > max_power: max_power = tmp_power display_power = display_power + str(max_power) + " " print(display_power[:-1])