Workstation assignment

Seat each arriving researcher at a freed workstation that stayed unlocked to save the most unlocks.

Medium5GreedyHeapSortingInterviewNo attempts yetTime limit10sMemory limit256 MB

Problem

Chansol manages a supercomputer that was installed recently. His job is to assign a workstation to every researcher who comes in to run a computation.

Unlocking a machine for each arriving researcher annoys Chansol, so he ignores the security policy and asks everyone to leave without locking the workstation. As long as an unlocked and empty workstation is around, he can seat the next researcher there and skip the unlock.

An empty workstation locks itself once the idle time passes mm minutes. An idle time of exactly mm minutes still leaves it unlocked. Researcher ii arrives at minute aia_i, stays for exactly sis_i minutes, and leaves at minute ai+sia_i + s_i. One workstation seats one researcher at a time.

If a researcher leaves a workstation at minute tt, that workstation passes to any other researcher arriving between minute tt and minute t+mt + m, both ends included, with no unlock. Assume there are enough workstations. Find the largest number of unlocks Chansol avoids when he assigns the workstations in the best possible way.

Input

The first line has the number of researchers nn and the idle limit mm after which a workstation locks itself. (1n3000001 \le n \le 300000, 1m1081 \le m \le 10^8)

Each of the next nn lines has the arrival minute aa and the stay length ss of one researcher, separated by a space. (1a,s1081 \le a, s \le 10^8)

Output

Print on one line the maximum number of unlocks Chansol can save.