#include<algorithm>
#include<iostream>

using namespace std;

int quadri(int N, long long M, int V[]) {
    // Scrivete qui la vostra soluzione
    int B = N;
  
    long long tot = 0;
    int l, r; l=r=-1;
    while(r<N-1) {
      r++;
      tot+=V[r];
      while(tot>M) {
        l++;
        B = min(B, r-l);
        tot-=V[l];
      }
    }
  
    return B;
}
