#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define ll long long
#define rep(i,a,b) for(int32 i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int32 i = (b) - 1; i >= (a); --i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define vint vector<int>
#define ALL(x) (x).begin(),(x).end()
#define C(x) cout << #x << ":" << x << endl
#define scanf scanf_s

using int32 = int_fast32_t;
using int64 = int_fast64_t;
using uint32 = uint_fast32_t;
using uint64 = uint_fast64_t;

using namespace std;
inline uint32 MIN(uint32 a, uint32 b){
	return a > b ? b : a;
}

int main() {
	uint32 n;
	uint32 s;
	cin >> n >> s;
	vector<uint32> a(n + 1);
	a[n] = 0;
	rep(i, 0, n)
		cin >> a[i];
	uint32 ans = n + 1;
	uint32 now = 0;
	uint32 l = 0, r = 0;
	while (r <= n){
		if (now < s){
			now += a[r++];
		}
		else{
			ans = MIN(ans, r-l);
			now -= a[l++];
		}
	}
	if (ans == n + 1) ans = 0;
	printf("%u\n", ans);
	return 0;
}