#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <algorithm>

#define SUBMIT 1

#ifndef SUBMIT
static FILE *fr, *fw;

// Declaring variables
static int N;
static long long M;
static int* V;
static int B;
#endif

// Declaring functions
int quadri(int N, long long M, int* V) {
    int sol = N;

    for (int i = 0; i < N; i++) {
        long long total = 0;

        int r = i;
        while (r < N && total + (long long)V[r] <= M) {
            total += (long long)V[r];
            r++;
        }

        sol = std::min(sol, r - i);

        if (r == N) break;
    }

    return sol;
}

#ifndef SUBMIT
int main() {
    freopen("input.txt", "r", stdin);

	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;
}
#endif
