#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N, S;
	cin >> N >> S;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	int l = 0, r = 0, sum = 0, res = N + 1;
	while (r <= N) {
		if (sum >= S) {
			res = min(res, r - l);
			sum -= a[l++];
		}
		else {
			sum += a[r++];
		}
	}
	cout << (res == N + 1 ? 0 : res) << endl;
	return 0;
}