#include<bits/stdc++.h>usingnamespace std;constint N =5e4+10;constint INF =1e9;int n, t;int w[N];int q[N];int f[N];boolcheck(int limit){int hh =0, tt =-1;
q[++tt]=0;for(int i =1; i <= n; i++){while(hh <= tt && q[hh]< i - limit -1) hh++;
f[i]= f[q[hh]]+ w[i];while(hh <= tt && f[q[tt]]>= f[i]) tt--;
q[++tt]= i;}int res = INF;for(int i = n - limit; i <= n; i++) res =min(res, f[i]);return res <= t;}intmain(){
cin >> n >> t;for(int i =1; i <= n; i++) cin >> w[i];int l =0, r = n;while(l < r){int mid = l + r >>1;if(check(mid)) r = mid;else l = mid +1;}
cout << l << endl;return0;}