#include <iostream>
#include <algorithm>
#define INF 9999999
using namespace std;

int main(void){
	int n,s;
	cin>>n>>s;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	int l=0,r=0;
	int sum=a[0];
	int res=INF;
	while(l<=r){
		if(sum<s){
			// sum less than s
			r++;
			if(r>=n)break;
			sum+=a[r];
		}else{
			res=min(res,r-l+1);
			sum-=a[l];
			l++;
		}
	}
	cout<<( (res==INF)?0:res )<<endl;
	return 0;
}