Larry the Lizard

Time limit: 1s Memory limit: 64MB Input: Output:

Task

Larry the lazy lizard is taking a very hard Physics class in school. In this class, there is no homework, only tests! He also, being very lazy, wants to study as little as possible for his tests.

He has NN tests to take in this class. For each tests, you are given two values: aia_i and bib_i. aia_i is the score he would receive if he studies, and bib_i is the score he would receive if he chooses not to study. Note that he can either study or not study, there is no in between.

His teacher has also has one conditional: he will only add up the scores of some N1N - 1 tests to get their final score! The teacher will randomly remove one test from the total score, but will tell Larry before all the tests are taken.

Note that the total score is calculated by sum of all his tests (unlike traditional schooling, their total score can get very high, not just out of 100100).

Given these conditions, please output the minimum amount of tests that Larry should study for to ensure that he gets a score of at least QQ, no matter what happens (QQ is the cutoff for an A in his class), or output 1-1 if it is not possible no matter how much he studies. You must output the answer for each of the potential tests that the teacher removes (i.e output nn integers, where the ithi^{\text{th}} integer represents the minimum number of tests to study for given that the teacher removes the ithi^{\text{th}} test).

Input data

The first line contains two space separated integers, NN and QQ. The next NN lines contain three integers, with the ithi^{\text{th}} line containing the space separated integers aia_i and bib_i, representing the scores after and before studying for that respective test.

Output data

Output NN lines, with the ithi^{\text{th}} line containing the minimum amount of tests to study for given that the teacher will remove the ithi^{\text{th}} test score, to get a total score of at least QQ, or 1-1 if it's not possible.

Constraints and clarifications

  • 1N1051 \leq N \leq 10^5;
  • 1Q1081 \leq Q \leq 10^8;
  • 1biai1041 \leq b_i \leq a_i \leq 10^4;
# Score Constraints
0 0 Example
1 40 N2 000N \leq 2 \ 000
2 60 No additional constraints

Example

stdin

3 5
5 0
3 2
2 1

stdout

2
1
1

Log in or sign up to be able to send submissions!