#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = ll(1e8+7);
const ll MAX_N = ll(1e5 + 5);
const ll INF = LLONG_MAX;
#define REP(i, n) for (int i = 0; i < n; i++)


int main() {
    ll n, a[MAX_N], sum = 0, S, ans = INF;
    cin >> n >> S;
    REP(i,n) cin >> a[i];
    ll left = 0, right = 0;
    while(right <= n){
        if(sum < S){
            sum += a[right];
            right++;
        }
        else {
            ans = min(ans, right - left);
            sum -= a[left];
            left++;
        }
    }
    cout << (ans==INF?0:ans) << endl;
    return 0;
}

