/*#include <stdio.h>
#include <assert.h>
#include <stdlib.h>

static FILE *fr, *fw;

// Declaring variables
static int N;
static long long M;
static int* V;
static int B;
*/
// Declaring functions
int quadri(int N, long long M, int V []) {
  long long sum = 0;
  int best = N+1;
  int l = 0;
  for (int r=0;r<N;r++) {
    sum +=V [r];
    while (sum>M) {
      if(r-l+1<best) {
        best = r-l+1;
        sum -= V[l];
        l++;
      }
    }
  }
  return best-1;
}
/*
int main() {
	fr = stdin;
	fw = stdout;

	// Iterators used in for loops
	int i0;

	// Reading input
	fscanf(fr, "%d %lld", &N, &M);
	V = (int*)malloc(N * sizeof(int));
	for (i0 = 0; i0 < N; i0++) {
	    fscanf(fr, "%d", &V[i0]);
	}

	// Calling functions
	B = quadri(N, M, V);

	// Writing output
	fprintf(fw, "%d\n", B);
	
	fclose(fr);
	fclose(fw);
	return 0;
}*/

