#include <numeric>

using namespace std;

int quadri(int N, long long M, int V[]) {
  int dB = N;
  int sB = 0;
  int B = (sB+dB)/2;
  int bB = 0;
  bool P = true;
  while(sB+1<dB){
    B = (sB+dB)/2;
    long long S = accumulate(V, V+B, 0LL);
    for(int i = 1; i<N-B+1; i++){
      if (S>M){
        P = false;
        break;
      }
      S += (V[i+B-1] - V[i-1]);
    }
    if (S>M || !P){
      dB = B-1;
    }
    else{
      sB = B;
      bB = B;
    }
    P = true;
  }
  return bB;
}