#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

using namespace std;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

long long int a[110000] = {};

int main(){
	
	int N, S;
	cin >> N >> S;
	
	for(int i = 0; i < N; i++){
		cin >> a[i];
	}
	
	long long int ans = INF;
	long long int P = 0, id = 0;
	
	for(int i = 0; i < N; i++){
		while(P < S && id != N){
			P += a[id];
			id += 1;
		}
		if(P >= S){
			ans = min(ans, id - i);
		}
		P -= a[i];
	}
	
	if(ans == INF){
		cout << 0 << endl;
	}else{
		cout << ans << endl;
	}
	
	return 0;
}

