n, x = map(int, input().split()) ans = [0] * x for i in range(n): a, b = map(int, input().split()) for j in range(x): if b - abs(j + 1 - a) > ans[j]: ans[j] = (b - abs(j + 1 - a)) print(*ans)