#include<stdio.h>
#define MAX 100001


int main(){
int n,S,i,j;
int sum=0;
int A[MAX];
int X[MAX];
int L=-1;

scanf("%d %d",&n,&S);
for(i=1;i<=n;i++){
 scanf("%d",&A[i]);
 sum+=A[i];
 X[i]=A[i];
 if(A[i]==S)L=1;
}


if(sum==S){L=n;}
else if(sum<S){L=0;}
else if(L!=1){

 for(i=1;i<n;i++){/*iは幅*/

  for(j=1;j<=n-i;j++){
   X[j]=X[j]+A[j+i];
   if(X[j]>=S){L=i+1;break;}
  }

  if(X[j]>=S)break;

 }

}


printf("%d\n",L);

return 0;
}
