from collections import deque N,X = map(int,input().split()) ans = [0]*X for _ in range(N): # A: 座標, B: 人数 q = deque([list(map(int,input().split()))]) while q: A,B = q.popleft() ans[A-1] = max(ans[A-1], B) if 1 < A and 1 < B: if ans[A-2] < B-1: q.append([A-1, B-1]) if A < X and 1 < B: if ans[A] < B-1: q.append([A+1, B-1]) print(*ans)