#include using namespace std; #define rep(i, s, n) for (int i = (s); i < (int)(n); i++) int main() { int n, length; int a[1001]; int b[1001]; int one_light[1001][1001]; bool flag = false; int tmp, sum; int rebase_a; cin >> n >> length; rep(i, 1, n + 1) cin >> a[i] >> b[i]; rep(i, 1, n + 1) { one_light[i][a[i] - 1] = b[i]; tmp = 0; flag = false; while (!flag) { if (a[i] - tmp - 1 >= 0 && b[i] - tmp > 0) one_light[i][a[i] - tmp - 1] = b[i] - tmp; if (a[i] + tmp <= length && b[i] - tmp > 0) one_light[i][a[i] + tmp - 1] = b[i] - tmp; if (a[i] - tmp - 1 < 1 && a[i] + tmp - 1 > length) flag = true; tmp++; } } rep(i, 0, length) { sum = 0; rep (j, 0, n + 1) { if (sum < one_light[j][i]) sum = one_light[j][i]; } cout << sum << " "; } return (0); }