Under construction

Still being built. Things may change

Pastries

Interview

Time limit2sMemory limit1024 MB

Summary
Find the maximum number of pastries Scrooge can eat within T seconds, starting at coordinate 0 on a line where each pastry at x_i takes t_i to eat.
Level

Medium5 of 10

Topics
Greedy, Heap, Sorting
Solved
No attempts yet

Problem

Today is Scrooge's birthday.

As a gift, he received an entire table of pastries. Millionaires have little free time, so Scrooge wants to eat as many pastries as possible in TT seconds.

The table is an infinite line. Each pastry is placed at coordinate xix_i. Moving from pastry ii to pastry jj takes ∣xi−xj∣|x_i - x_j| seconds. Eating pastry ii takes tit_i seconds. Pastries at the same point need no movement between them, but they must be eaten one at a time.

Scrooge starts at coordinate 00. Find the maximum number of pastries he can eat within TT seconds.

Input

The first line contains two integers nn and TT (1≤n≤100 0001 \le n \le 100\,000, 1≤T≤1091 \le T \le 10^9), the number of pastries and the available time.

Each of the next nn lines contains two integers xix_i and tit_i (1≤xi,ti≤1091 \le x_i, t_i \le 10^9), the coordinate of the ii-th pastry and the time needed to eat it. The pastries are given in non-decreasing order of coordinate, that is, xi≤xjx_i \le x_j whenever i<ji < j.

Output

Print one line with the maximum number of pastries Scrooge can eat within TT seconds.

Hint

In the first sample, Scrooge goes from coordinate 00 to coordinate 11, eats the first pastry, then moves to coordinate 33 and eats the third pastry.

Examples3

  1. Example 1

    Input
    3 10
    1 4
    2 5
    3 3
    
    Expected output
    2
    
  2. Example 2

    Input
    3 10
    1 2
    2 2
    3 3
    
    Expected output
    3
    
  3. Example 3

    Input
    8 100
    1 21
    3 10
    4 3
    5 19
    8 8
    9 32
    50 1
    100 1
    
    Expected output
    5