#include<bits/stdc++.h> using namespace std; const int NX = 1e5+10; int dp[NX],N,S; void solve() { int sum,low,high,ans = N+1; sum = dp[0]; low=high = 0; while(high<N) { if(sum>=S) { ans = min(ans,high-low+1); } if(sum>=S && low<high) { sum-=dp[low]; low++; } else { high++; if(high<N) sum+=dp[high]; } } printf("%d\n",ans==N+1?0:ans); return; } int main() { int i,j; while(scanf("%d%d",&N,&S)!=EOF) { for(i=0;i<N;i++) { scanf("%d",&dp[i]); } solve(); } return 0; }