#include <cstdio>
#include <iostream>
#include <algorithm>
#define maxn 50005
using namespace std;
struct TreeNodeType {
int l,r,dis,mid;
};
struct TreeNodeType tree[maxn<<2];
int if_z,n,t,cost[maxn],ans;
char Cget;
inline void read_int(int &now)
{
now=0,if_z=1,Cget=getchar();
while(Cget>‘9‘||Cget<‘0‘)
{
if(Cget==‘-‘) if_z=-1;
Cget=getchar();
}
while(Cget>=‘0‘&&Cget<=‘9‘)
{
now=now*10+Cget-‘0‘;
Cget=getchar();
}
now*=if_z;
}
void tree_build(int now,int l,int r)
{
tree[now].l=l,tree[now].r=r;
if(l==r) return ;
tree[now].mid=(l+r)>>1;
tree_build(now<<1,l,tree[now].mid);
tree_build(now<<1|1,tree[now].mid+1,r);
}
inline void tree_up(int now)
{
tree[now].dis=min(tree[now<<1].dis,tree[now<<1|1].dis);
}
void tree_start(int now)
{
tree[now].dis=0;
if(tree[now].l==tree[now].r) return ;
tree_start(now<<1),tree_start(now<<1|1);
}
void tree_change(int now,int to,int x)
{
if(tree[now].l==tree[now].r&&tree[now].l==to)
{
tree[now].dis=x;
return ;
}
if(to<=tree[now].mid) tree_change(now<<1,to,x);
else tree_change(now<<1|1,to,x);
tree_up(now);
}
int tree_query(int now,int l,int r)
{
if(tree[now].l==l&&tree[now].r==r)
{
return tree[now].dis;
}
if(l>tree[now].mid) return tree_query(now<<1|1,l,r);
else if(r<=tree[now].mid) return tree_query(now<<1,l,r);
else
{
return min(tree_query(now<<1,l,tree[now].mid),tree_query(now<<1|1,tree[now].mid+1,r));
}
}
void tree_check(int now)
{
if(tree[now].l==tree[now].r)
{
printf("%d ",tree[now].dis);
return ;
}
tree_check(now<<1);tree_check(now<<1|1);
}
bool check(int size)
{
size++;
tree_start(1);
for(int i=1;i<=n+1;i++)
tree_change(1,i,tree_query(1,max(0,i-size),i-1)+cost[i]);
//tree_check(1);
//printf("\n");
int pos=tree_query(1,n+1,n+1);
if(pos<=t) return true;
else return false;
}
int main()
{
read_int(n),read_int(t);
for(int i=1;i<=n;i++) read_int(cost[i]);
int lit=1,rit=n,mid;
ans=n;
tree_build(1,0,n+1);
while(lit<=rit)
{
mid=(lit+rit)>>1;
if(check(mid))
{
rit=mid-1;
ans=mid;
}
else lit=mid+1;
}
printf("%d\n",ans);
return 0;
}