#include<cstdio>
#include<algorithm>

using namespace std;


int main()
{
    int N, S, A[100000];

    scanf("%d %d", &N, &S);
    for (int i = 0; i < N; i++) scanf("%d", &A[i]);

    int tail = 0, sum = 0, ret = 114514;
    for (int i = 0; i < N; i++) {
        while (tail < N && sum < S) {
            sum += A[tail++];
        }
        if (sum >= S) ret = min(ret, tail - i);
        sum -= A[i];
    }

    if (ret == 114514) ret = 0;
    printf("%d\n", ret);
}

