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