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

int main() {
    int n, s;
    cin >> n >> s;
    vector<int> a(n), sum(n+1, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum[i+1] = sum[i] + a[i];
    }
    
    auto f = [&](int k) {
        bool flag = false;
        for (int i = 0; i+k <= n; i++) {
            int sec = sum[i+k] - sum[i];
            if (sec >= s) {
                flag = true;
                break;
            }
        }
        return flag;
    };
    
    int ok = n, ng = -1;
    while (abs(ok - ng) > 1) {
        int x = (ok + ng) / 2;
        if (f(x)) ok = x;
        else ng = x;
    }
    
    if (sum[n] < s) ok = 0;
    cout << ok << endl;
    return 0;
}
