Melons

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

In EGOI Farm, the employees are receiving and shipping melons. This morning, NN melons are received. The melons are numbered from 11 to NN. The weight of melon ii (1iN1 ≤ i ≤ N) is A_iA\_i.

Rie is working at EGOI Farm. Her job is packing melons into boxes. Now, an integer xx (1xN1 ≤ x ≤ N) is determined in EGOI Farm. After that, she will receive the melons x,x+1,,Nx, x + 1, \dots , N, in this order. She will pack them into boxes by repeating the following process.

  • Rie will take an empty box. She will repeat putting the melons into the box. However, if the total weight of the melons in the box will exceeds LL after putting the next melon into the box, she will not put it into the box. Then, she will ship the box. (In this case, she will put the next melon into a new box.)

After putting the melon NN into a box, she will ship the box, and her job will be finished.

Rie wants to prepare for her job for all possible values of xx. Write a program which, given information of the melons and the maximum possible weight LL of a box, calculates the number of boxes shipped by her and the total weight of the melons in the last box for all possible values of xx.

입력

Read the following data from the standard input. Given values are all integers.

NN LL

A_1A\_1

A_2A\_2

\vdots

A_NA\_N

출력

Write NN lines to the standard output. The ii-th line (1iN1 ≤ i ≤ N) of output corresponds to the case x=ix = i. This line should contain the number of shipped boxes and the total weight of the melons in the last box if x=ix = i. These two values should be separated by a space.

제한

  • 1N200,0001 ≤ N ≤ 200\\,000.
  • 1L1,000,000,000(=109)1 ≤ L ≤ 1\\,000\\,000\\,000 (= 10^9).
  • 1A_iL1 ≤ A\_i ≤ L (1iN1 ≤ i ≤ N).