#include<stdio.h>
#define min(a,b) ((a)<(b)?(a):(b))
#define INF 10000000
int a[100000];

int main(void)
{
	int N, S,sum;
	int res;
	int i,j;
	scanf("%d %d",&N,&S);
	for (i = 0; i < N; i++) {
		scanf("%d", &a[i]);
		sum += a[i];

		while (sum - a[j] >= S) {
			sum -= a[j];
			j++;
		}
		if (sum >= S)res = min(res, i - j + 1);
	}
	if (res == INF)res = 0;
		printf("%d\n", res);
	return 0;
}