#include<stdio.h>
#include<stdlib.h>

void run(void){
  int n,s;
  scanf("%d%d",&n,&s);
  int *a=(int *)calloc(n,sizeof(int));
  int i,j;
  for(i=0;i<n;i++) scanf("%d",a+i);
  int min=n+1;
  j=0;
  for(i=0;i<n;i++){
    while(j<n && s>0) s-=a[j++];
    if(s<=0 && j-i<min) min=j-i;
    s+=a[i];
  }
  printf("%d\n",min==n+1?0:min);
}

int main(void){
  run();
  return 0;
}

