CF1279B Verse For Santa

题目描述

### 题意简述 给定正整数 $n$,$s$ 和长为 $n$ 的整数数列 $a_1,a_2,...,a_n$。 求一个最大的 $i$,使得存在一个 $j$ 满足 $1\leq j\leq i$,让 $(\sum_{k=1}^{i} a_k) -a_j \leq s$ 。

输入格式

**本题有多组数据**。 第一行一个正整数 $t(1\leq t\leq 100)$,表示数据组数。 对于每组数据,第一行两个正整数 $n$,$s(1\leq n \leq 10^5,1\leq s \leq 10^9)$。 接下来一行 $n$ 个整数 $a_1,a_2,...,a_n(1\leq a_i \leq 10^9)$。 保证输入的 $n$ 之和不超过 $10^5$。

输出格式

对于每组数据,输出 $j$,意义如题意所述。如果存在多个 $j$ 输出任意一个。 特殊的,如果 $\sum_{i=1}^{n} a_i \leq s$,输出 $0$。

说明/提示

In the first test case if Vasya skips the second part then he gets three gifts. In the second test case no matter what part of the verse Vasya skips. In the third test case Vasya can recite the whole verse.