Magic Transport
题号:NC273391
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Alice needs to transport a total of N items. Let's label each item with numbers from 1 to N. Alice has a magic power that allows her to transport items with a total weight not exceeding M at once.

Now Alice has a question: for the first i items, under the condition that the i-th item must be selected, as many items as possible should be chosen from the first i items to be transported using magic. At this point, what is the minimum number of remaining items among the first i items?

Reminder: There may be items with a weight of 0 in the data.

输入描述:

The first line contains the number of test cases T (1 \le T \le 10).
For each test case, the first line contains the number of items N and the total weight M for magic transportation.
The next line contains N integers, representing the weight a_i of each item.

输出描述:

For each test case, output one line containing N integers. The i-th integer represents the number of remaining items after applying magic as required for the first i items.
示例1

输入

复制
2
7 15
1 2 3 4 5 6 7
5 100
80 40 40 40 60

输出

复制
0 0 0 0 0 2 3
0 1 1 2 3

备注:

For all data, 1 \le N \le 10^5, 1 \le M \le 10^9, T \le 10, 0 \le a[i] \le M.