PivotOJ

DVONIZ

시간 제한: 1000ms메모리 제한: 128MB출처: COCI 2010-2011BOJ 2855

문제

We say that a sequence of 2*K elements is interesting if neither the sum of the first K elements, nor the sum of the last K elements, is greater than S. 

A sequence A of length N is given. For every element, output the length of the longest interesting subsequence starting with that element. 

입력

The first line contains integers N and S (2 ≤ N ≤ 100 000, 1 ≤ S ≤ 2*109). 

The following N lines contain the sequence A, one integer per line. The integers are positive and their sum does not exceed 2*109

출력

Output must consist of N lines. i-th line must contain one integer, the length of the longest interesting subsequence starting with the i-th element. If an interesting subsequence at that position doesn’t exist, output 0 (zero). 

예제

예제 1

입력
5 10000
1
1
1
1
1
출력
4
4
2
2
0

예제 2

입력
5 9
1
1
10
1
9
출력
2
0
0
2
0

예제 3

입력
8 3
1
1
1
1
1
1
1
1
출력
6
6
6
4
4
2
2
0
코드를 제출하려면 로그인하세요.