atcoder#ARC068C. [ARC068E] Snuke Line

[ARC068E] Snuke Line

Score : 700700 points

Problem Statement

Snuke has decided to play a game, where the player runs a railway company. There are M+1M+1 stations on Snuke Line, numbered 00 through MM. A train on Snuke Line stops at station 00 and every dd-th station thereafter, where dd is a predetermined constant for each train. For example, if d=3d = 3, the train stops at station 00, 33, 66, 99, and so forth.

There are NN kinds of souvenirs sold in areas around Snuke Line. The ii-th kind of souvenirs can be purchased when the train stops at one of the following stations: stations lil_i, li+1l_i+1, li+2l_i+2, ......, rir_i.

There are MM values of dd, the interval between two stops, for trains on Snuke Line: 11, 22, 33, ......, MM. For each of these MM values, find the number of the kinds of souvenirs that can be purchased if one takes a train with that value of dd at station 00. Here, assume that it is not allowed to change trains.

Constraints

  • 1N3×1051 \leq N \leq 3 \times 10^{5}
  • 1M1051 \leq M \leq 10^{5}
  • 1liriM1 \leq l_i \leq r_i \leq M

Input

The input is given from Standard Input in the following format:

NN MM

l1l_1 r1r_1

::

lNl_{N} rNr_{N}

Output

Print the answer in MM lines. The ii-th line should contain the maximum number of the kinds of souvenirs that can be purchased if one takes a train stopping every ii-th station.

3 3
1 2
2 3
3 3
3
2
2
  • If one takes a train stopping every station, three kinds of souvenirs can be purchased: kind 11, 22 and 33.
  • If one takes a train stopping every second station, two kinds of souvenirs can be purchased: kind 11 and 22.
  • If one takes a train stopping every third station, two kinds of souvenirs can be purchased: kind 22 and 33.
7 9
1 7
5 9
5 7
5 9
1 1
6 8
3 4
7
6
6
5
4
5
5
3
2