#include #if __has_include("./debug.cpp") #include "./debug.cpp" #else #define debug(...) #define print_line #endif using namespace std; using ll = long long; int main() { int N, X; cin >> N >> X; vector val(X + 1, 0); for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; val[a] = max(val[a], b); for (int i = 1; i <= b; i++) { if (a - i >= 1) val[a - i] = max(val[a - i], b - i); if (a + i <= X) val[a + i] = max(val[a + i], b - i); } } for (int i = 1; i <= X; i++) { cout << val[i] << ' '; } cout << endl; }