N, X = map(int, input().split()) town = [0]*1001 for _ in range(N): A, B = map(int, input().split()) town[A] = max(town[A], B) for i in range(1, B): if A+i <= 1000: town[A+i] = max(town[A+i], B-i) if A-i >= 0: town[A-i] = max(town[A-i], B-i) print(*town[1:X+1])