#include <stdio.h>
#define min(p,q)((p)<(q)?(p):(q))

int a[100010];
int main(){
	int n,s;
	scanf("%d%d",&n,&s);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	int ans=1e6;
	int r=0,sum=0;
	for(int l=0;l<n;l++){
		while(r<n&&sum<s)sum+=a[r++];
		if(sum>=s)ans=min(ans,r-l);
		sum-=a[l];
	}
	printf("%d\n",ans==1e6?0:ans);
}

