N,X = map(int, input().split()) AB = [] for i in range(N): a,b = map(int, input().split()) AB.append((a-1,b)) print(AB) Lij = [[0 for _ in range(N)] for _ in range(X)] for i in range(N): a,b = AB[i] st = a-b #y=x for j in range(b): if st+j >=0: Lij[st+j][i] = j for j in range(b): if st+b+j < X: Lij[st+b+j][i] = b-j L = [max(Lij[i]) for i in range(X)] print(*L)