N,X=map(int,input().split()) AB=[list(map(int,input().split())) for i in range(N)] ANS=[0]*(X+3) for a,b in AB: ANS[a]=b for i in range(1,X+1): ANS[i]=max(ANS[i],ANS[i-1]-1) for a,b in AB: ANS[a]=b for i in range(X,-1,-1): ANS[i]=max(ANS[i],ANS[i+1]-1) print(*ANS[1:X+1])