#include<bits/stdc++.h>
using namespace std;long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){cin.tie(0);ios::sync_with_stdio(false);cin>>N>>s;for(;i<N;i++){cin>>a;S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;cout<<A<<endl;return 0;}}}