/**
 * Sliding Window - The Smallest Window I
 */

#include <iostream>

using namespace std;

int main() {

    int N, S, a[100000];

    cin >> N >> S;

    for (int i = 0; i < N; i++) cin >> a[i];

    //
    int s, t, sum, ans;
    s = t = sum = 0;
    ans = N + 1;

    while (true) {
        while (t < N && sum < S) {
            sum += a[t++];
        }
        if (sum < S) break;
        ans = min(ans, t - s);
        sum -= a[s++];
    }

    if (ans > N) ans = 0;

    cout << ans << endl;
}
