#include <bits/stdc++.h>
#define inf (long long)1e9
using namespace std;

long long n, s;
vector<long long> a;

long long solve();

int main() {
  cin >> n >> s;
  a.resize(n);
  for(int i = 0; i < n; ++i) cin >> a[i];
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = inf, sum = 0, l = 0, r = 0;
  for(l = 0; l < n; ++l) {
    while(r < n && sum < s) sum += a[r++];
    if(sum >= s) ans = min(ans, r - l);
    sum -= a[l];
  }
  return ans == inf ? 0 : ans;
}
