Jeff is very indecisive. Whenever an opportunity arises, he rarely decides to pursue it. Each opportunity in Jeff’s life has two characteristics:
: the amount of happiness Jeff would gain if he chooses to take this opportunity.
: the amount of energy it would cost Jeff to take this opportunity.
Jeff has a limited amount of energy, .
Over moments in Jeff's life, opportunities either appear or disappear:
Now, at the end of his life, Jeff is filled with regrets. For each moment , he wonders what the maximum happiness he could have achieved would have been if he had chosen to take some of the available opportunities, using no more than his available energy .
Since Jeff doesn’t have the time to solve this problem himself, he’s asking for your help.
the first line contains two integers and , the number of moments in Jeff's life and the amount of energy Jeff has.
for the next lines, the i-th line contains two integers each and the amount of happiness and the energy cost of the opportunity.
if Jeff previously had the opportunity with the same values the opportunity is no longer available otherwise the opportunity becomes available.
output should contain numbers the i-th number should be the maximum amount of happiness Jeff could've achieved if he had chosen to take some of the available opportunities at the i-th moment such that the amount of energy he loses is at most .