#include<stdio.h>
int  a[100000];
int main(){
    int i, r=0, l=0, n, lmin=100000;
    long s, sum=0;
    scanf("%d %d", &n, &s);
    for(i=0; i<n; i++)scanf("%d", &a[i]);
    while(r<=n){
        if(sum>=s){
            if(lmin>r-l)lmin=r-l;
            sum-=a[l++];
        }
        else if(sum<s)sum+=a[r++];
    }
    if(r-l==n+1&&sum<s)lmin=0;
    printf("%d\n", lmin);
    return 0;
}