#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,S,ma = 0,mi = 0,ans = 1000000;
  cin >> N >> S;
  vector<int> a(N);
  for(int i = 0;i < N;i++)cin >> a[i];
  int sum = a[0];
  while(1){
    if(sum < S){
      ma++;
      if(ma == N)break;
      sum += a[ma];
    }
    else{
      ans = min(ma-mi+1,ans);
      sum -= a[mi];
      mi++;
    }
  }
  if(ans != 1000000)cout << ans << endl;
  else cout << 0 << endl;
}

