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