#include <bits/stdc++.h>
using namespace std;
int main() {
	long long a, N, s, A = (LLONG_MAX), l = 0, r = 0, S[100002] = { 0 }; cin >> N >> s;
	for (int i = 1; i <= N;i++) { cin >> a;S[i] += S[i - 1] + a; }
	for(;;){
		if (S[r] - S[l] >= s) { A = min(A, r - l); l++; }else r++;
		if (r > N || l > N) { if (A == (LLONG_MAX))A = 0; cout << A << endl; return 0; }
	}
}