아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Roller Coaster

시간 제한2초메모리 제한1024 MB

요약
줄을 서 있는 각 단체가 롤러코스터에 전원 탑승할 수 있는 출발 시각을 순서대로 구한다.
난이도

보통10점 중 4점

유형
시뮬레이션, 구현
정답자
아직 제출이 없습니다

문제

In Japan Amusement Group (JAG), members discuss how to have better amusement to attract many people. These days, they are interested in reducing waiting time stress.

As a member of JAG, you found out the hypothesis that knowing waiting time can reduce such kind of stress. Therefore, you decided to write a program which presumes the waiting time of a roller coaster.

NN groups stand in line for the roller coaster, and the groups are numbered from 11 to NN. The group ii has a_ia\_i people. People in line ride the roller coaster in ascending order of group number.

The first roller coaster departs at time and departs every minute thereafter. The roller coaster can hold up to MM people.

For each group, the whole group member must ride the roller coaster at the same time. Additionally, there is no need to get exactly MM people on the roller coaster at one time. Each group wants to ride the roller coaster as soon as possible, so they ride it if they can.

You should output NN lines. In the ii-th line, you should output the time the group ii can ride the roller coaster.

입력

NN MM

a_1a\_1 a_2a\_2 …\dots a_Na\_N

The first line consists of an integer NN between 11 and 100,000100\\,000, and an integer MM between 11 and 10910^9, inclusive. NN represents the number of groups, and MM represents the capacity of the roller coaster.

The second line consists of NN integers between 11 and MM, inclusive. For each ii (1≤i≤N1 \le i \le N), a_ia\_i represents the number of people in the group ii.

출력

Output NN lines. In the ii-th line, you should output the answer for the group ii.

예제2

  1. 예제 1

    입력
    3 5
    2 4 1
    
    예상 출력
    0
    1
    1
    
  2. 예제 2

    입력
    2 1000000000
    1000000000 1000000000
    
    예상 출력
    0
    1