#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define BR "\n"

int main() {
  int N, S;
  cin >> N >> S;

  vector<ll> a(N);
  rep0(i, N) cin >> a[i];

  ll ans = 1e9;
  ll temp = 0;
  ll l = 0, r = 0;
  while (true) {
    if (temp >= S) {
      ans = min(ans, r - l);
      temp -= a[l];
      l++;
    } else {
      if (r >= N) break;
      temp += a[r];
      r++;
    }
  }
  if (ans == 1e9) ans = 0;

  cout << ans << BR;
  return 0;
}
