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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int N, S;
    cin >> N >> S;
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    int t = 0, ans = N + 1;
    ll total = 0;
    for (int s = 0; s < N; s++) {
        for (; t < N && total < S; t++) total += a[t];
        if (total < S) break;
        ans = min(ans, t - s);
        total -= a[s];
    }
    if (ans <= N) cout << ans << endl;
    else cout << 0 << endl;
}
