AT_abc485_f [ABC485F] Big Bridge

Description

There are $ N $ items $ 1,2,\dots,N $ , one of each. Item $ i $ has a price of $ c_i $ and a value of $ v_i $ . Each time Takahashi crosses a bridge, the price of every item whose price is at least $ 1 $ decreases by $ 1 $ . For each $ j=0,1,\dots,M $ , find the following value. - The maximum possible total value of the chosen items when, after Takahashi has crossed the bridge $ j $ times, zero or more items are chosen so that their total price is at most $ M $ .

Input Format

The input is given from Standard Input in the following format: > $ N $ $ M $ $ c_1 $ $ v_1 $ $ c_2 $ $ v_2 $ $ \vdots $ $ c_N $ $ v_N $

Output Format

Print the answers in $ M+1 $ lines in total. The $ k $ -th line should contain the answer for $ j=k-1 $ .

Explanation/Hint

### Sample Explanation 1 For $ j=0 $ , the prices of all items remain as they were initially. Choosing items $ 1 $ and $ 2 $ makes the total value $ 8 $ , which is the maximum possible. For $ j=1 $ , the prices of all items decrease by $ 1 $ . Choosing items $ 1 $ , $ 2 $ , and $ 3 $ makes the total value $ 16 $ , which is the maximum possible. ### Constraints - $ 1 \leq N \leq 10^2 $ - $ 1 \leq c_i \leq M \leq 10^4 $ - $ 1 \leq v_i \leq 10^9 $ - All input values are integers.