#include #include using namespace std; using namespace atcoder; using ll = long long; int main(){ int n, x; cin >> n >> x; vector a (n), b (n); vector l (x + 1, 0); for(int i = 0; i < n; ++i){ cin >> a[i] >> b[i]; } for(int i = 0; i < n; ++i){ for(int j = 0; j <= b[i]; ++j){ if(a[i] - j <= x && a[i] - j >= 1) l[a[i] - j] = max(l[a[i] - j], b[i] - j); } for(int j = 0; j <= b[i]; ++j){ if(a[i] + j <= x && a[i] + j >= 1) l[a[i] + j] = max(l[a[i] + j], b[i] - j); } } for(int i = 0; i < x; ++i){ cout << l[i + 1] << " "; } cout << endl; }