#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n , x , a[10000],s=0,d=0;
cin>>n>>x;
for ( int i=0 ; i<n;i++)
{
cin>>a[i];
}
long long slow=0;
for ( long long fast=1 ; fast < n ; fast++ )
{
s+=a[fast];
while ( a[fast] + a[slow] > x && slow <= fast)
{
s-=a[slow];
slow++;
}
if ( s <= x )
{
d=max(d , fast-slow+1);
}
}
cout<<d;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYWluKCkKewoJbG9uZyBsb25nIG4gLCB4ICwgYVsxMDAwMF0scz0wLGQ9MDsKCWNpbj4+bj4+eDsKCWZvciAoIGludCBpPTAgOyBpPG47aSsrKQoJewoJCQoJCWNpbj4+YVtpXTsKCQkKCX0KCWxvbmcgbG9uZyBzbG93PTA7Cglmb3IgKCBsb25nIGxvbmcgZmFzdD0xIDsgZmFzdCA8IG4gOyBmYXN0KysgKQoJewoJCXMrPWFbZmFzdF07CgkJd2hpbGUgKCBhW2Zhc3RdICsgYVtzbG93XSA+IHggJiYgc2xvdyA8PSBmYXN0KQoJCXsKCQkJcy09YVtzbG93XTsKCQkJc2xvdysrOwoJCX0KCQlpZiAoIHMgPD0geCApCgkJewoJCQlkPW1heChkICwgZmFzdC1zbG93KzEpOwoJCX0KCX0KCWNvdXQ8PGQ7CglyZXR1cm4gMDsKCQp9