#include <vector>
using namespace std;
using ll=long long;
bool isPoss(int B,int N,ll M,vector<ll>&pr){
    for (int i=0;i<=N-B;i++){
        if (pr[i+B]-pr[i]>M)
            return false;
    }
    return true;
}
int quadri(int N, long long M, int V[]) {
    vector<ll>pre_sum(N+1);
    pre_sum[0]=0;
    for (int i=0;i<N;i++){
        pre_sum[i+1]=pre_sum[i]+V[i];
    }
    int l=0,r=N+1;
    while (r-l!=1){
        int m=(l+r)/2;
        if (isPoss(m,N,M,pre_sum))
            l=m;
        else
            r=m;
    }
    return l;
}
