N, X = map(int, input().split()) res = [0] * X indexlist = [] for _ in range(N): index, val = map(int, input().split()) res[index-1] = val indexlist.append(index-1) for i in indexlist: cur = res[i] - 1 cur3 = res[i] for j in range(i, X): if res[j] < cur: res[j] = cur cur -= 1 else: break cur1 = res[i] - 1 for j in reversed(range(0, i)): if res[j] < cur1: res[j] = cur1 cur1 -= 1 else: break print(*res)