#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;

int n,x;
int a,sum=0;
int main()
{
	cin>>n>>x;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		sum+=a;
	}
	cout<<abs(sum-1)/x+1<<endl;
	return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <ctime>
#include <functional>

using namespace std;
#define FR(i,n) for(LL i=0;i<(LL)n;i++)
int main()
{

    int n,x,sum=0; cin>>n>>x;
    FR(i,n)
    {
        int x; cin>>x;
        sum+=x;
    }

    if(sum<0) sum=sum*-1;
    int res=sum/x;
    if(sum%x) res++;

    cout<<res<<endl;

    return 0;
}


#include <iostream>
#include <cstring>
#include <math.h>

using namespace std;

int main(int argc, char *argv[])
{
    int x,n,i,s,s1;
    int a[100];
    cin>>n;
    cin>>x;
    s=0;
    for ( i=0; i<n;i++)
    {
        cin>>a[i];
        s=s+a[i];
    }
    s1=abs(s)/x;
    if(abs(s)%x==0)
    cout<<s1;
    else
    cout<<s1+1;

    return EXIT_SUCCESS;
}


#include <iostream>
#include <cstring>
#include <math.h>

using namespace std;

int main(int argc, char *argv[])
{
    int x,n,i,s,s1;
    int a[1000];
    cin>>n;
    cin>>x;
    s=0;
    for ( i=0; i<n;i++)
    {
        cin>>a[i];
        s=s+a[i];
    }
    s1=abs(s)/x;
    if(abs(s)%x==0)
    cout<<s1;
    else
    cout<<s1+1;

    return EXIT_SUCCESS;
}


#include <iostream>
#include <cstring>
#include <math.h>

using namespace std;

int main() {
int n,d,t,s=0,res=0;

    r(n); r(d);
    FOR(i,0,n)
    {
        r(t);
        s += t;
    }
    s = abs(s);

    while(s>0)
    {
        res++;
        s-=d;
    }

    wl(res);

    return 0;
}


#include <iostream>
#include <cstring>
#include <math.h>

using namespace std;

int main()
{
    //freopen("in.txt","r",stdin);

    int n,x,sum=0; cin>>n>>x;
    FR(i,n)
    {
        int x; cin>>x;
        sum+=x;
    }

    if(sum<0) sum=sum*-1;
    int res=sum/x;
    if(sum%x) res++;

    cout<<res<<endl;

    return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int main(){

	int n;
	cin>>n;
	int x;cin>>x;
	int sum=0;
	int y;
	for(int i=0;i<n;i++){
		cin>>y;
		sum+=y;
	}
	double r=sum;
	double rr=abs(r);

	int tot=0;
	while(rr>0)
	{
		tot++;
		rr-=x;
	}
	cout<<tot<<endl;
	return 0;
}


#include <iostream>
using namespace std;
int main() {
    int n, x, b, cnt, a;
    b=cnt=0;
    cin>>n>>x;
    for(int i=0; i<n; i++) {
        cin>>a;
        b+=a;
    }
    while(b!=0) {
        if(b>0) {
            if(b-x>0)  {
                cnt++;
                b-=x;
            }
            else {
                cnt++;
                b=0;
            }
        }
        else {
            if(b+x<0) {
                cnt++;
                b+=x;
            }
            else {
                cnt++;
                b=0;
            }
        }
    }
   cout<<cnt<<endl;

    return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int sum=0;
	int n,x;
	cin>>n>>x;
	int y;
	for(int i=0;i<n;i++)
	{
		cin>>y;
		sum+=y;
	}
	sum=abs(sum);

	cout<<(sum/x)+(sum%x)<<endl;

return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int sum=0;
int n,x,k;
cin>>n>>x;
for(int i=0;i<n;i++)
{
cin>>k;
sum+=k;
}
if(sum==0)
cout<<0<<endl;

else if(sum>=-x && sum<=x)
	cout<<1<<endl;

else
{
	int y=abs(sum);
	int o=y/x;

cout<<o+1<<endl;
}

return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int sum=0;
	int n,x;
	cin>>n>>x;
	int y;
	for(int i=0;i<n;i++)
	{
		cin>>y;
		sum+=y;
	}

	int cnt=0;
	sum=abs(sum);
	while(sum!=0)
	{
		if((sum-x)>0)
		{
cnt++;
sum-=x;
		}
		else
		{
cnt++;
sum=0;
		}

	}
	cout<<cnt<<endl;

return 0;
}


//IN THE NAME OF GOD
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <map>
#include <fstream>
#include <utility>
#include <sstream>
#include <list>
#include <iomanip>
#include <functional>
#include <deque>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <complex>
#include <climits>
#include <cctype>
#include <cassert>
#include <bitset>
#include <limits>
#include <numeric>

#pragma comment(linker, "/STACK:1024000000,1024000000")

using namespace std;

#define timestamp(x) printf("Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define INF 1000000000
#define pii pair < int , int >
#define MP make_pair
#define MOD 1000000
#define EPS 1e-9
#define LL long long
#define MAXN 200000+10
#define bug cout<<"!!!!!!!!!!!!!!!!!";

int main()
{
    ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
    //freopen("o.txt", "w", stdout);
#endif
    int n, x , sum = 0 , tmp ;
    cin >> n >> x;
    for (int i = 0; i < n; i++){
        cin >> tmp;
        sum += tmp;
    }
    int z = x, ans = 0;
    while (sum != 0){
        while ( abs(sum) < z) z--;
        if ( sum > 0 )
            sum -= z;
        else sum += z;
        ans++;
    }
    cout << ans << endl ;
    /*int x, k , tmp ;
    cin >> x >> k;
    vector < int > v;
    v.assign(x, -1);
    v[x - 1] = 0;
    for (int i = 0; i < k; i++){
        cin >> tmp;
        if (tmp == 1){
            int a, b;
            cin >> a >> b;
            v[a - 1] = v[b - 1] = 0;
        }
        else{
            int a;
            cin >> a;
            v[a - 1] = 0;
        }
    }
    vector < int > ans;
    for (int i = 0; i < x; i++){
        if (v[i] == -1) ans.push_back(i);
    }
    sort(ans.begin(), ans.end());
    int res = 0 , i = 0 ;
    for ( i ; ans.size() && i < ans.size()-1 ; ){
        if (ans[i + 1] - ans[i] == 1) res++, i += 2;
        else res++, i++;
    }
    for (i; i < ans.size(); i++) res++;
    cout << res << ' ' << ans.size() << endl;*/
    return 0;
}


//IN THE NAME OF GOD
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <map>
#include <fstream>
#include <utility>
#include <sstream>
#include <list>
#include <iomanip>
#include <functional>
#include <deque>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <complex>
#include <climits>
#include <cctype>
#include <cassert>
#include <bitset>
#include <limits>
#include <numeric>

#pragma comment(linker, "/STACK:1024000000,1024000000")

using namespace std;

#define timestamp(x) printf("Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define INF 1000000000
#define pii pair < int , int >
#define MP make_pair
#define MOD 1000000
#define EPS 1e-9
#define LL long long
#define MAXN 200000+10
#define bug cout<<"!!!!!!!!!!!!!!!!!";

int main()
{
    ios::sync_with_stdio(false);
//#ifndef ONLINE_JUDGE
   // freopen("i.txt", "r", stdin);
    //freopen("o.txt", "w", stdout);
//#endif
    int n, x , sum = 0 , tmp ;
    cin >> n >> x;
    for (int i = 0; i < n; i++){
        cin >> tmp;
        sum += tmp;
    }
    int z = x, ans = 0;
    while (sum != 0){
        while ( abs(sum) < z) z--;
        if ( sum > 0 )
            sum -= z;
        else sum += z;
        ans++;
    }
    cout << ans;
    return 0;
}


//IN THE NAME OF GOD
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <map>
#include <fstream>
#include <utility>
#include <sstream>
#include <list>
#include <iomanip>
#include <functional>
#include <deque>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <complex>
#include <climits>
#include <cctype>
#include <cassert>
#include <bitset>
#include <limits>
#include <numeric>

#pragma comment(linker, "/STACK:1024000000,1024000000")

using namespace std;

#define timestamp(x) printf("Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define INF 1000000000
#define pii pair < int , int >
#define MP make_pair
#define MOD 1000000
#define EPS 1e-9
#define LL long long
#define MAXN 200000+10
#define bug cout<<"!!!!!!!!!!!!!!!!!";

int main()
{
    ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
    //freopen("o.txt", "w", stdout);
#endif
    int n, x , sum = 0 , tmp ;
    cin >> n >> x;
    for (int i = 0; i < n; i++){
        cin >> tmp;
        sum += tmp;
    }
    int z = x, ans = 0;
    while (sum != 0){
        while ( abs(sum) < z) z--;
        if ( sum > 0 )
            sum -= z;
        else sum += z;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


//IN THE NAME OF GOD
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <map>
#include <fstream>
#include <utility>
#include <sstream>
#include <list>
#include <iomanip>
#include <functional>
#include <deque>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <complex>
#include <climits>
#include <cctype>
#include <cassert>
#include <bitset>
#include <limits>
#include <numeric>

#pragma comment(linker, "/STACK:1024000000,1024000000")

using namespace std;

#define timestamp(x) printf("Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define INF 1000000000
#define pii pair < int , int >
#define MP make_pair
#define MOD 1000000
#define EPS 1e-9
#define LL long long
#define MAXN 200000+10
#define bug cout<<"!!!!!!!!!!!!!!!!!";

int main()
{
    ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
    //freopen("o.txt", "w", stdout);
#endif
    int n, x , sum = 0 , tmp ;
    cin >> n >> x;
    for (int i = 0; i < n; i++){
        cin >> tmp;
        sum += tmp;
    }
    int z = x, ans = 0;
    while (sum != 0){
        while ( abs(sum) < z) z--;
        if ( sum > 0 )
            sum -= z;
        else sum += z;
        ans++;
    }
    cout << ans;
    return 0;
}


#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int n,x,a,c;
	a=0;
	c=0;
	cin>>n>>x;
	int *z = new int[n];
	for(int i=0;i<=n-1;i++)
	{
		cin>>z[i];
		a+=z[i];
	}
	if(a!=0)
	{
		if((a%x)!=0)
		{
			if((x+abs(a%x))==abs(a))
				cout<<x+abs(a%x);
			else
				cout<<abs(a%x);
		}
		else
			cout<<1;
	}
	else

		cout<<0;
}


#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int n,x,a,c;
	a=0;
	cin>>n>>x;
	int *z = new int[n];
	for(int i=0;i<=n-1;i++)
	{
		cin>>z[i];
		a+=z[i];
	}
	c=a/x;
	if(a!=0)
	{
		if(abs(a%x)<x && abs(a%x)!=x)
		{
			c=abs(c)+1;
			cout<<abs(c);
		}
		else if(abs(a%x)==x)
		{
			cout<<x;
		}
		else if (abs(a%x)==0)
		{
			cout<<1;
		}
	}
	system("pause");
}


#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int n,x,a,c;
	a=0;
	c=0;
	cin>>n>>x;
	int *z = new int[n];
	for(int i=0;i<=n-1;i++)
	{
		cin>>z[i];
		a+=z[i];
	}
	if(a!=0)
	{
		if((a%x)!=0)
		{
			if((x+abs(a%x))==abs(a))
				cout<<x-abs(a%x);
			else
				cout<<abs(a%x);
		}
		else
			cout<<1;
	}
	else

		cout<<0;
}


#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int n,x,a,c;
	a=0;
	cin>>n>>x;
	int *z = new int[n];
	for(int i=0;i<=n-1;i++)
	{
		cin>>z[i];
		a+=z[i];
	}
	a=abs(a);
	c=a/x;
	if(a!=0)
	{
		if(a!=x)
		{
			if(a>x)
			{
				c++;
				cout<<c;
			}
			if(a<x)
				cout<<1;
		}
		else
			cout<<1;

	}
	else
	{
		cout<<0;
	}
}


#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int n,x,a,c;
	a=0;
	cin>>n>>x;
	int *z = new int[n];
	for(int i=0;i<n;i++)
	{
		cin>>z[i];
		a+=z[i];
	}
	a=abs(a);
	c=a/x;
	if(a!=0)
	{
		if(a!=x)
		{
			if(a>x)
			{
				if(a%x==0)
					cout<<c;
				else
				{
					c++;
					cout<<c;
				}
			}
			if(a<x)
				cout<<1;
		}
		else
			cout<<1;

	}
	else
		cout<<0;
	return 0;
}


#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int n,x,a,c;
	a=0;
	c=0;
	cin>>n>>x;
	int *z = new int[n];
	for(int i=0;i<=n-1;i++)
	{
		cin>>z[i];
		a+=z[i];
	}
	if(a!=0)
	{
		if((a%x)!=0)
		{
			if((x+abs(a%x))==abs(a))
				cout<<2;
			else
				cout<<abs(a%x);
		}
		else
			cout<<1;
	}
	else
		cout<<0;
}


#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int n,x,a,c;
	a=0;
	cin>>n>>x;
	int *z = new int[n];
	for(int i=0;i<=n-1;i++)
	{
		cin>>z[i];
		a+=z[i];
	}
	c=a/x;
	if(a!=0)
	{
		if(abs(a)!=x)
		{
			if(abs(a)>x)
			{
				c=abs(c)+1;
				cout<<c;
			}
			if(abs(a)<x)
				cout<<1;
		}
		else
			cout<<1;

	}
	else
	{
		cout<<0;
		return 0;
	}
}


#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int n,x,a,c;
	a=0;
	c=0;
	cin>>n>>x;
	int *z = new int[n];
	for(int i=0;i<=n-1;i++)
	{
		cin>>z[i];
		a+=z[i];
	}
	if(a!=0)
	{
		if((a%x)!=0)
			cout<<a%x;
		else
			cout<<1;
	}
	else
		cout<<0;
}


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

int n, t;
vector<int> pre;
vector<int> books;

int main()
{
    cin >> n >> t;

    int preAdd = 0;

    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;

        books.push_back(x);

        preAdd+=x;
        pre.push_back(preAdd);
    }

    int largestBooks = 0;
    int lp = 0, rp = 0;

    int largeL, largeR;
    largestBooks = rp - lp;

    while (rp != n)
    {
        if ((pre[rp] - pre[lp] <= t))
        {
            if (rp - lp > largestBooks)
            {
                largestBooks = rp - lp;
                largeL = lp;
                largeR = rp;
            }
            rp++;
        } else
        {
            lp++;
        }
    }

    cout << largestBooks << endl;

//    cout << "---------------" << endl;

//    cout << largeL << " " << largeR << endl;

}


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

int n, t;
vector <int> a;

int main()
{
    cin >> n >> t;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;

        a.push_back(x);
    }

    auto x = min_element(a.begin(), a.end());
    int minIndex = x - a.begin();

    int time = 0;
    int ans = 0;
    int totalBooks = 0;
    int i = minIndex;

    while ( (time < t) && (i < a.size()) )
    {
        if (time + a[i] <= t)
        {
            time += a[i];
            ans++;

        } else
        {
            break;
        }
        i++;

        if (i == a.size() && totalBooks != a.size())
        {
            i = 0;
        }
    }

    cout << ans << endl;
}


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

int n, t;
vector <int> a;

int main()
{
    cin >> n >> t;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;

        a.push_back(x);
    }

    sort(a.begin(), a.end());

    int time = 0;
    int ans = 0;
    int i = 0;

    while (time < t)
    {
        if (time + a[i] <= t)
        {
            time += a[i];
            ans++;

        } else
        {
            break;
        }
        i++;
    }

    cout << ans << endl;
}


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

int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;

	long int t;

	cin >> n >> t;

	int a[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];

	long int prefixSum[n];

	prefixSum[0] = a[0];

	for (int i = 1; i < n; i++)
		prefixSum[i] = prefixSum[i - 1] + a[i];

	int i = 0 , j = n - 1 , length;

	while (i < j)
	{
		if (prefixSum[j] <= t) {
			if (i != 0)
				length = j - i + 1;
			else
				length = j - i;
			break;
		}
		else if (prefixSum[j] - prefixSum[i] <= t)
		{
			if (i != 0)
				length = j - i + 1;
			else
				length = j - i;
			break;
		}
		else if (prefixSum[j] - prefixSum[j - 1] > prefixSum[i + 1] - prefixSum[i]) {
			j--;

		}
		else if (prefixSum[j] - prefixSum[j - 1] <= prefixSum[i + 1] - prefixSum[i]) {
			i++;

		}
	}

	cout << length;

}


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

int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;

	long int t;

	cin >> n >> t;

	int a[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];

	long int prefixSum[n];

	prefixSum[0] = a[0];

	for (int i = 1; i < n; i++)
		prefixSum[i] = prefixSum[i - 1] + a[i];

	int i = 0 , j = n - 1 , length;

	while (i <= j)
	{
		if (n == 1) {
			if (a[0] <= t)
				length = 1;
			else
				length = 0;

			break;
		}
		if (prefixSum[j] <= t) {
			if (i != 0)
				length = j - i + 1;
			else
				length = j - i;
			break;
		}
		else if (prefixSum[j] - prefixSum[i] <= t)
		{
			if (i != 0)
				length = j - i + 1;
			else
				length = j - i;
			break;
		}
		else if (prefixSum[j] - prefixSum[j - 1] > prefixSum[i + 1] - prefixSum[i]) {
			j--;

		}
		else if (prefixSum[j] - prefixSum[j - 1] <= prefixSum[i + 1] - prefixSum[i]) {
			i++;

		}
	}

	cout << length;

}


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

int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	long long int t;

	cin >> n >> t;

	int a[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];

	long long int prefixSum[n];

	prefixSum[0] = a[0];

	for (int i = 1; i < n; i++)
		prefixSum[i] = prefixSum[i - 1] + a[i];

	int i = 0 , j = n - 1 , length;

	while (i <= j) {

		if (prefixSum[j] <= t) {
			length = j;
			break;
		}
		else if (prefixSum[j] - prefixSum[i] <= t) {

			length = j - i;
			break;
		}
		else if (prefixSum[j] - prefixSum[j - 1] > prefixSum[i + 1] - prefixSum[i]) {
			j--;
		}
		else if (prefixSum[i + 1] - prefixSum[i] >= prefixSum[j] - prefixSum[j - 1]) {
			i++;
		}
	}

	cout << length;

}


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

int main() {

	int n;
	long long int v[n];
	cin >> n;

	for (int i = 0; i < n; i++)
		cin >> v[i];

	long long int prefixSum[n] , prefixSumSorted[n];

	prefixSum[0] = v[0];

	for (int i = 1; i < n; i++)
		prefixSum[i] = prefixSum[i - 1] + v[i];

	for (int i = 0; i < n; i++)
		cout << prefixSum[i];

	/*sort(v , v + n);

	prefixSumSorted[0] = v[0];

	for (int i = 1; i < n; i++)
		prefixSumSorted[i] = prefixSumSorted[i - 1] + v[i];

	int m , l , r, type;

	cin >> m;

	while (m--) {

		cin >> type >> l >> r;

		if (type == 1) {
			if (l > 1)
				cout << prefixSum[r - 1] - prefixSum[l - 2] << endl;
			else
				cout << prefixSum[r - 1] << endl;
		}
		else
		{
			if (l > 1)
				cout << prefixSumSorted[r - 1] - prefixSumSorted[l - 2] << endl;
			else
				cout << prefixSumSorted[r - 1] << endl;
		}
	}*/
}


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

int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n , t;

	cin >> n >> t;

	int a[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];

	int length = 0;

	int sum = 0 , right = 0 , left = 0;

	for (right = 0; right < n; right++) {

		sum += a[right];

		if (sum > t)
			sum -= a[left++];

		length = max(length , right - left + 1);
	}

	cout << length;

}


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

int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;

	long int t;

	cin >> n >> t;

	int a[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];

	long int prefixSum[n];

	prefixSum[0] = a[0];

	for (int i = 1; i < n; i++)
		prefixSum[i] = prefixSum[i - 1] + a[i];

	int i = 0 , j = n - 1 , length;

	while (i < j)
	{
		if (n == 1) {
			if (a[0] <= t)
				length = 1;
			else
				length = 0;

			break;
		}
		if (prefixSum[j] <= t) {
			if (i != 0)
				length = j - i + 1;
			else
				length = j - i;
			break;
		}
		else if (prefixSum[j] - prefixSum[i] <= t)
		{
			if (i != 0)
				length = j - i + 1;
			else
				length = j - i;
			break;
		}
		else if (prefixSum[j] - prefixSum[j - 1] > prefixSum[i + 1] - prefixSum[i]) {
			j--;

		}
		else if (prefixSum[j] - prefixSum[j - 1] <= prefixSum[i + 1] - prefixSum[i]) {
			i++;

		}
	}

	cout << length;

}


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

int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;

	long int t;

	cin >> n >> t;

	int a[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];

	long int prefixSum[n];

	prefixSum[0] = a[0];

	for (int i = 1; i < n ; i++)
		prefixSum[i] = prefixSum[i - 1] + a[i];

	int i = 0 , j = n - 1  , length;

	while (i <= j)
	{
		if (n == 1) {
			if (a[0] <= t)
				length = 1;
			else
				length = 0;

			break;
		}
		else if (prefixSum[j] <= t) {
			length = j + 1;
			break;
		}
		else if (prefixSum[j] - prefixSum[i] <= t)
		{

			length = j - i;

			break;
		}
		else if (prefixSum[j] - prefixSum[j - 1] > prefixSum[i + 1] - prefixSum[i]) {
			j--;

		}
		else if (prefixSum[j] - prefixSum[j - 1] <= prefixSum[i + 1] - prefixSum[i]) {
			i++;

		}
	}

	cout << length;

}


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

int main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	long long int t;

	cin >> n >> t;

	int a[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];

	long long int prefixSum[n];

	prefixSum[0] = a[0];

	for (int i = 1; i < n; i++)
		prefixSum[i] = prefixSum[i - 1] + a[i];

	int i = 0 , j = n - 1 , length;

	if(n == 1){

		if(a[0] <= t)
		{
			length = 1;
			cout << length;
			return 0;
		}
	}

	while (i <= j) {

		if (prefixSum[j] <= t) {
			length = j;
			break;
		}
		else if (prefixSum[j] - prefixSum[i] <= t) {

			length = j - i;
			break;
		}
		else if (prefixSum[j] - prefixSum[j - 1] > prefixSum[i + 1] - prefixSum[i]) {
			j--;
		}
		else if (prefixSum[i + 1] - prefixSum[i] >= prefixSum[j] - prefixSum[j - 1]) {
			i++;
		}
	}

	cout << length;

}


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

int main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	long long int t;

	cin >> n >> t;

	int a[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];

	long long int prefixSum[n];

	prefixSum[0] = a[0];

	for (int i = 1; i < n; i++)
		prefixSum[i] = prefixSum[i - 1] + a[i];

	int i = 0 , j = n - 1 , length;

	if(n == 1){

		if(a[0] <= t)
		{
			length = 1;
			cout << length;
			return 0;
		}
	}

	while (i <= j) {

		if (prefixSum[j] <= t) {

			length = j+1;

			break;
		}
		else if (prefixSum[j] - prefixSum[i] <= t) {

			length = j - i;
			break;
		}
		else if (prefixSum[j] - prefixSum[j - 1] > prefixSum[i + 1] - prefixSum[i]) {
			j--;
		}
		else if (prefixSum[i + 1] - prefixSum[i] >= prefixSum[j] - prefixSum[j - 1]) {
			i++;
		}
	}

	cout << length;

}


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

int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;

	long int t;

	cin >> n >> t;

	int a[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];

	long int prefixSum[n];

	prefixSum[0] = a[0];

	for (int i = 1; i < n; i++)
		prefixSum[i] = prefixSum[i - 1] + a[i];

	int i = 0 , j = n - 1 , length;

	while (i <= j)
	{
		if (n == 1) {
			if (a[0] <= t)
				length = 1;
			else
				length = 0;

			break;
		}
		if (prefixSum[j] <= t) {

			length = j - i + 1;

			break;
		}
		else if (prefixSum[j] - prefixSum[i] <= t)
		{

			length = j - i + 1;

			break;
		}
		else if (prefixSum[j] - prefixSum[j - 1] > prefixSum[i + 1] - prefixSum[i]) {
			j--;

		}
		else if (prefixSum[j] - prefixSum[j - 1] <= prefixSum[i + 1] - prefixSum[i]) {
			i++;

		}
	}

	cout << length;

}


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

int main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	long long int t;

	cin >> n >> t;

	long long int a[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];

	long long int prefixSum[n];

	prefixSum[0] = a[0];

	for (int i = 1; i < n; i++)
		prefixSum[i] = prefixSum[i - 1] + a[i];

	int i = 0 , j = n - 1 , length;

	if(n == 1){

		if(a[0] <= t)
		{
			length = 1;
			cout << length;
			return 0;
		}
	}

	while (i <= j) {

		if (prefixSum[j] <= t) {

			length = j+1;

			break;
		}
		else if (prefixSum[j] - prefixSum[i] <= t) {

			length = j - i;
			break;
		}
		else if (prefixSum[j] - prefixSum[j - 1] > prefixSum[i + 1] - prefixSum[i]) {
			j--;
		}
		else if (prefixSum[i + 1] - prefixSum[i] >= prefixSum[j] - prefixSum[j - 1]) {
			i++;
		}
	}

	cout << length;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,t,res=0;
    cin>>n>>t;
    long long sum=0;
    int a[n],com[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
        com[i]=sum;
    }
    if(com[n-1]<=t)
        res=com[n-1];

    for(int i=0;i<n;i++)
    {
        if(com[n-1]-com[i]<=t&&n-i>res)
            res=n-i-1;
    }
    cout<<res;
}


#include<bits/stdc++.h>
using namespace std;
int cnt[12345];
int main()
{
    int n,res=0;
    long long t,sum=0;
    cin>>n>>t;
    int a[n];
    long long com[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        cnt[a[i]]++;
        sum+=a[i];
        com[i]=sum;
    }
    if(com[n-1]>t)
    {
        for(int i=10000;i>=1;--i)
        {
            while(cnt[i]>0&&com[n-1]>t)
            {
                com[n-1]-=i;
                cnt[i]--;
            }
        }
        for(int i=0;i<10005;i++)
        {
            if(cnt[i]>0)
                res+=cnt[i];
        }
        cout<<res;
    }
    else
        cout<<n;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,t,res=0;
    cin>>n>>t;
    long long x=0;
    int a[n],com[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=0;i<n;i++)
    {
        if(res+a[i]<=t)
        {
            res+=a[i];
            x++;
        }
    }
    cout<<x;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    unsigned long long n,t,ans=0;
    cin>>n>>t;
    unsigned long long a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        unsigned long long res=0,x=0;
        for(int j=i;j<n;j++)
        {
            if(res+a[j]<=t)
            {
                res+=a[j];
                x++;
            }
        }
        if(x>ans)
            ans=x;
    }
    cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,t,res=0;
    cin>>n>>t;
    long long sum=0;
    int a[n],com[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
        com[i]=sum;
    }
    if(com[n-1]<=t)
    {
        cout<<com[n-1];
        return 0;
    }

    for(int i=0;i<n;i++)
    {
        if(com[n-1]-com[i]<=t)
        {
            cout<<n-i-1;
            return 0;
        }
    }
    cout<<res;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,t,ans=0;
    cin>>n>>t;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        long long res=0,x=0;
        for(int j=i;j<n;j++)
        {
            if(res+a[j]<=t)
            {
                res+=a[j];
                x++;
            }
        }
        if(x>ans)
            ans=x;
    }
    cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,t,res=0;
    cin>>n>>t;
    long long x=0;
    long long a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=0;i<n;i++)
    {
        if(res+a[i]<=t)
        {
            res+=a[i];
            x++;
        }
    }
    cout<<x;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,t,ans=0;
    cin>>n>>t;
    long long a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        long long res=0,x=0;
        for(int j=i;j<n;j++)
        {
            if(res+a[j]<=t)
            {
                res+=a[j];
                x++;
            }
        }
        if(x>ans)
            ans=x;
    }
    cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,t,res=0;
    cin>>n>>t;
    int a[n];
    vector<int>v;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]<=t)
            v.push_back(a[i]);
    }
    n=v.size();
    for(int i=0;i<n;i++)
    {
        int temp=t,cnt=0;
        for(int j=i;j<n;j++)
        {
            if(temp>=a[j])
            {
                temp-=a[j];
                cnt++;
            }
            if(temp==0)
                break;
        }
        if(cnt>res)
            res=cnt;
    }
    cout<<res;
}


#include<bits/stdc++.h>
using namespace std;
int cnt[12345];
int main()
{
    int n,res=0;
    long long t,sum=0;
    cin>>n>>t;
    long long a[n];
    long long com[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        cnt[a[i]]++;
        sum+=a[i];
        com[i]=sum;
    }
    if(com[n-1]>t)
    {
        for(int i=10000;i>=1;--i)
        {
            while(cnt[i]>0&&com[n-1]>t)
            {
                com[n-1]-=i;
                cnt[i]--;
            }
        }
        for(int i=0;i<10005;i++)
        {
            if(cnt[i]>0)
                res+=cnt[i];
        }
        cout<<res;
    }
    else
        cout<<n;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,t,res=0;
    cin>>n>>t;
    long long sum=0;
    int a[n],com[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
        com[i]=sum;
    }
    if(com[n-1]<=t)
        res=com[n-1];

    for(int i=0;i<n;i++)
    {
        if(com[n-1]-com[i]<=t&&n-i>res)
            res=n-i-1;
    }
    cout<<res;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    unsigned long long n,t,ans=0;
    cin>>n>>t;
    unsigned long long a[n];
    for(unsigned long long i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(unsigned long long i=0;i<n;i++)
    {
        unsigned long long res=0,x=0;
        for(unsigned long long j=i;j<n;j++)
        {
            if(res+a[j]<=t)
            {
                res+=a[j];
                x++;
            }
        }
        if(x>ans)
            ans=x;
    }
    cout<<ans;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,t,ele=0,k=0,res=0;
    cin>>n>>t;
    int a[n];
    long long sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]<=t)
        {
            if(sum+a[i]<=t)
            {
                sum+=a[i];
                ele++;
            }
            else if(sum+a[i]>t)
            {
                if(ele>res)
                    res=ele;
                while(sum+a[i]>t&&k<i)
                {
                    sum-=a[k];
                    k++;
                    ele--;
                }
                if(sum+a[i]<=t)
                {
                    sum+=a[i];
                    ele++;
                }
            }
        }

    }
    if(ele>res)
        res=ele;
    cout<<res;
}


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

int get_sum_starting_from_index_i(int start, int t, vector<int> &v){
    int curt = 0, cnt = 0;
    for(int i = start; i < v.size(); i++){
        curt += v[i];
        cnt++;
        if(curt > t){
            cnt--;
            return cnt;
        }
    }
    return cnt;
}

int main(){
    int n, t;
    cin >> n >> t;
    vector<int> v(n);
    for(int i = 0; i < n; i++)
        cin >> v[i];

    for(int i = 0; i < n; i++){
        cout << get_sum_starting_from_index_i(i, t, v) << endl;
    }
    return 0;
}


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

int n, t;
int ar[100001];

bool valid(int sz){
    for(int i = sz; i <= n; i++)
        if(ar[i] - ar[i - sz] <= t)
            return true;
    return false;
}

int main(){
    cin >> n >> t;
    for(int i = 1; i <= n; i++){
        cin >> ar[i];
        ar[i] += ar[i - 1];
    }
    int s = 0, e = n;
    while(s < e){
        int mid = s + (e - s + 1) / 2;
        if(valid(mid))
            s = mid;
        else
            e = mid - 1;
    }
    cout << s << endl;
    return 0;
}


#include<iostream>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

bool can(int mid, vector<int> &v, int t){
    int sum = 0;
    for(int i = 0; i < mid; i++) sum += v[i];
    if(sum <= t) return true;
    int i = 0, j = mid;
    while(j < int(v.size())){
        sum += v[j];
        sum -= v[i];
        if(sum <= t) return true;
        i++;
        j++;
    }
    return false;
}

int main(){
    int n,t;
    scanf("%d%d", &n, &t);
    vector<int> v(n);
    for(int i = 0; i < n; i++) scanf("%d", &v[i]);
    int s = 0, e = n;
    while(s < e){
        int mid = s + (e - s + 1) / 2;
        if(can(mid, v, t))
            s = mid;
        else e = mid - 1;
    }
    printf("%d\n", s);
}


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

int n, t;
int v[100005];

int main() {
	scanf("%d %d", &n, &t);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &v[i]);
		if (i)
			v[i] += v[i - 1];
	}

	int i = 1, j = i, ans = 0;
	while (i <= n) {
		if (t > v[j] - v[i - 1]) {
			if (j + 1 > n)
				i++;
			else
				j++;
		} else if (t < v[j] - v[i - 1]) {
			i++;
		}
		else {
			ans = max(ans, j - i + 1);
			i++;
		}
		if (t >= v[j] - v[i - 1])
			ans = max(ans, j - i + 1);
	}
	printf("%d\n", ans);
}


///*
// * 12049 - Just Prune The List.cpp
// *
// *  Created on: Sep 5, 2016
// *      Author: Mostafa
// */
//#include<bits/stdc++.h>
//
//using namespace std;
//typedef pair<int, int> ii;
//typedef vector<ii> vii;
//typedef vector<int> vi;
//typedef long long ll;
//
//
//int main () {
//	int t;
//	cin>>t;
//	while(t--) {
//		int n1,n2;
//		cin>>n1>>n2;
//		map<int,int>m1,m2;
//		set<int>s;
//		for(int i=0;i<n1;i++) {
//			int x;
//			cin>>x;
//			s.insert(x);
//			m1[x]++;
//		}
//		for(int i=0;i<n2;i++) {
//			int x;
//			cin>>x;
//			s.insert(x);
//			m2[x]++;
//		}
//
//		int res=0;
//		set<int>::iterator it;
//		for(it=s.begin();it!=s.end();it++) {
//			res+=abs(m1[*it]-m2[*it]);
//		}
//		cout<<res<<endl;
//	}
//
//	return 0;
//}

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

int n, t;
int v[100005];

bool can(int d){
	for(int i = d; i <= n; i++){
		if(v[i] - v[i - d] <= t) return true;
	}
	return false;
}

int main() {
	scanf("%d %d", &n, &t);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &v[i]);
		if (i)
			v[i] += v[i - 1];
	}
	int s = 0, e = n;
	while(s < e){
		int mid = s + (e - s + 1) / 2;
		if(can(mid)) s = mid;
		else e = mid - 1;
	}
	printf("%d\n", s);
}


#include <bits/stdc++.h>

using namespace std;

#define sz(v) (int)v.size()

bool valid(int m, vector<int> &v, int t) {
	if (v[m - 1] <= t)
		return true;
	for (int i = m; i < sz(v); i++) {
		if(v[i] - v[i - m] <= t) return true;
	}
	return false;
}

int main() {
//	freopen("in.in", "rt", stdin);
	int n, t;
	scanf("%d%d", &n, &t);
	vector<int> v(n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &v[i]);
		if (i)
			v[i] += v[i - 1];
	}
	int s = 0, e = n;
	while (s < e) {
		int mid = s + (e - s + 1) / 2;
		if (valid(mid, v, t))
			s = mid;
		else
			e = mid - 1;
	}
	printf("%d\n", s);
}


#include <bits/stdc++.h>

using namespace std;

#define sz(v) (int)v.size()

bool valid(int m, vector<int> &v, int t) {
	if (v[m - 1] <= t)
		return true;
	for (int i = m; i < sz(v); i++) {
		if (v[i] - v[i - m] <= t)
			return true;
	}
	return false;
}

int main() {
//	freopen("in.in", "rt", stdin);
	int n, t;
	scanf("%d%d", &n, &t);
	vector<int> v(n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &v[i]);
	}
	int s = 0, e = 0, mx = 0, sum = 0;
	while (s < n) {
		if (e + 1 <= n && sum + v[e] <= t) {
			sum += v[e];
			mx = max(mx, e - s + 1);
			e++;
		} else {
			sum -= v[s];
			s++;
		}
	}
	printf("%d\n", mx);
}


#include <bits/stdc++.h>
#include <algorithm>
#include<iostream>
#include<cmath>
#include <vector>
using namespace std;

/*
8 4
-1 2 -3 5 -2 -6 7 -8
5 - 4 = 0
*/

int main(){
    int n, t;
    scanf("%d %d", &n, &t);
    vector<int> v(n);
    for(int i = 0; i < n; i++)
        scanf("%d", &v[i]);
    int s = 0, e = 0;
    int sum = 0, mx = 0;
    while(s < n){
        if(e < n && v[e] + sum <= t){
            sum += v[e];
            mx = max(mx, e - s + 1);
            e++;
        }else if(s < e) {
            sum -= v[s];
            s++;
        }else{
            s++; e++;
        }
    }
    printf("%d\n", mx);
}

//int main(){
//  int a , b , c , d , n ;
//  while(cin>>a>>b>>c>>d){
//      if(a==0&&b==0&&c==0&&d==0)
//          break;
//
//        n=((360-(abs((a-b)*9))+(abs(b-c)*9)+(360-(abs(c-d)*9))+1080);
//
//      cout<<n<<endl;
//  }
//}


#include <bits/stdc++.h>
#include<iostream>
#include<cmath>
#include <vector>
using namespace std;
/*
4 5

v
12 1 2 1
   ^

*/
int main(){
    int n, t;
    scanf("%d %d", &n, &t);
    vector<int> v(n);
    for(int i = 0; i < n; i++) scanf("%d", &v[i]);
    int s = 0, e = 0;
    int mx = 0, sum = 0;
    while(s < n){
        if(e < n && sum + v[e] <= t){
            sum += v[e];
            mx = max(mx, e - s + 1);
            e++;
        }
        else if(e > s){
            sum -= v[s];
            s++;
        }else {
            s++, e++;
        }
    }
    printf("%d\n", mx);
}

//int main(){
//  int a , b , c , d , n ;
//  while(cin>>a>>b>>c>>d){
//      if(a==0&&b==0&&c==0&&d==0)
//          break;
//
//        n=((360-(abs((a-b)*9))+(abs(b-c)*9)+(360-(abs(c-d)*9))+1080);
//
//      cout<<n<<endl;
//  }
//}


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

int n, t;
int v[100005];

int main() {
	scanf("%d %d", &n, &t);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &v[i]);
		if (i)
			v[i] += v[i - 1];
	}

	int i = 1, j = i, ans = 0;
	while (i <= n) {
		if (t > v[j] - v[i - 1]) {
			if (j + 1 > n)
				i++;
			else
				j++;
			j = max(j, i);
		} else if (t < v[j] - v[i - 1]) {
			i++;
		}
		else {
			ans = max(ans, j - i + 1);
			i++;
		}
		if (t >= v[j] - v[i - 1])
			ans = max(ans, j - i + 1);
	}
	printf("%d\n", ans);
}


#include <iostream>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define F first
#define S second
int arr[500111];
int main()
{
    int n,t;
    cin>>n>>t;
    for(int i=0;i<n;i++)cin>>arr[i];
    int l=0 , r=0 , ans=0 , sum=arr[0];
    while(r<n && l<=r)
    {
        cout<<sum<<"<==sum  ans==> "<<ans<<endl;
        if(sum<=t)
        {
            r++;
            sum+=arr[r];
            ans++;
        }
        else
        {
            ans--;
            sum-=arr[l];
            l++;
        }
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std ;
vector<int> v ;
int main ()
{
    int n,t ;
    cin >> n >> t ;
    for(int i=0; i<n ; i++)
    {
        int x ;
        cin >> x ;
        v.push_back(x);
    }
    sort(all(v)) ;
    int sum=0,cnt=0 ;
    for(int i =0; i<n ; i++)
    {
        sum+=v[i] ;
        if(sum<=t)
        {
            cnt++ ;
        }
        else
            break ;
    }
    cout << cnt ;
    return 0 ;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mk make_pair
#define pb push_back
#define F first
#define S second
int A[100001];
vector<int> v;
int ans,sum;
int main()
{
    int n,t;
    cin>>n>>t;
    for(int i=0;i<n;i++)
    {
        cin>>A[i];
    }
    int j=0,cnt=0;
    for(int i=0;i<n;i++)
    {
        sum+=A[i];
        cnt++;
        while(sum>t)
        {
            sum-=A[j];
            cnt--;
            j++;
        }
        ans=max(ans,cnt);
    }
    cout<<ans;
}


#include<bits/stdc++.h>
using namespace std ;
#define ll long long
const int MX=1e6+123 ;
int Arr[MX];
int main()
{
    int n ,t,cnt=0,k=0,ans=0 ;
    cin >> n >> t ;
    ll sum=0 ;
    for(int i=0;i<n;i++)
    {
        sum+=Arr[i];
        cnt++;
        while(sum<t)
        {
            sum-=Arr[k];
            cnt--;
            k++;
        }
        ans=max(ans,cnt);
    }
    cout << ans;
}


#include<bits/stdc++.h>
using namespace std ;
#define ll long long
const int MX=1e6+123 ;
int Arr[MX];
int main()
{
    int n ,t,cnt=0,k=0,ans=0 ;
    cin >> n >> t ;
    ll sum=0 ;
    for(int i=n-1;i>=0;i--)
    {
        sum+=Arr[i];
        cnt++;
        while(sum<t)
        {
            sum-=Arr[k];
            cnt--;
            k++;
        }
        ans=max(ans,cnt);
    }
    cout << ans;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mk make_pair
#define pb push_back
#define F first
#define S second
int A[100001];
vector<int> v;
ll ans;
int cnt;
int main()
{
    int n,t;
    cin>>n>>t;
    for(int i=0;i<n;i++)
    {
        cin>>A[i];
    }
    for(int i=0;i<n;i++)
    {
        ans+=A[i];
        if(ans>t){ans-=A[i]; continue;}
        else {cnt++;}
    }
    cout<<cnt;
}


#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std ;
vector<int> v ;
int main ()
{
    int n,t;
    cin>>n>>t;
    vector<int> v;
    while(n--)
    {
        int x;
        cin>>x;
        v.push_back(x);
    }
    int res=0,c=0,sum=0,k=0;
    for(int i=0; i<v.size(); i++)
    {
        sum+=v[i];
        c++;
        while(sum>t)
        {
            sum-=v[k];
            c--;
            k++;
        }
        res=max(res,c);
    }
    cout<<res;
return 0 ;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mk make_pair
#define pb push_back
#define F first
#define S second
int A[100001];
vector<int> v;
ll ans;
int cnt;
int main()
{
    int n,t;
    cin>>n>>t;
    for(int i=0;i<n;i++)
    {
        cin>>A[i];
    }
    for(int i=0;i<n;i++)
    {
        ans+=A[i];
        if(ans>t){ break;}
        else {cnt++;}
    }
    cout<<cnt;
}


#include<bits/stdc++.h>
using namespace std ;
#define ll long long
const int MX=1e6+123 ;
int Arr[MX];
int main()
{
    int n ,t,cnt=0,k=0,ans=0 ;
    cin >> n >> t ;
    ll sum=0 ;
    for(int i=n-1;i>=0;i--)
    {
        sum+=Arr[i];
        cnt++;
        while(sum<t)
        {
            sum-=Arr[k];
            cnt--;
            k++;
        }
        ans=max(ans,cnt);
    }
}


#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std ;
vector<int> v ;
int main ()
{
    int n,t ;
    cin >> n >> t ;
    for(int i=0; i<n ; i++)
    {
        int x ;
        cin >> x ;
        v.push_back(x);
    }
    int sum=0,cnt=0 ;
    for(int i =0; i<n ; i++)
    {
        sum+=v[i] ;
        if(sum<=t)
        {
            cnt++ ;
        }
        else
            sum-=v[i] ;
    }
    cout << cnt ;
    return 0 ;
}


#include <iostream>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define F first
#define S second
int arr[500111];
int main()
{
    int n,t;
    cin>>n>>t;
    for(int i=0;i<n;i++)cin>>arr[i];
    int l=0 , r=0 , ans=0 , sum=arr[0];
    while(r<n && l<=r)
    {
        //cout<<sum<<"<==sum  ans==> "<<ans<<endl;
        if(sum<=t)
        {
            r++;
            sum+=arr[r];
            ans++;
        }
        else
        {
            ans--;
            sum-=arr[l];
            l++;
        }
    }
    if(ans<0)ans=0;
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std ;
#define ll long long
const int MX=1e6+123 ;
ll Arr[MX];
int main()
{
    int n ,m,cnt=0 ;
    cin >> n >> m ;
    ll sum=0 ;
    for(int i=0;i<n;i++) cin >> Arr[i];
    for(int i=0;i<n;i++) sort(Arr,Arr+n);
    for(int i=0;i<n;i++)
    {
        sum+=Arr[i];
        if(sum>m)break ;
        cnt++ ;
    }
    cout << cnt ;
}


#include<bits/stdc++.h>
using namespace std ;
#define ll long long
const int MX=1e6+123 ;
int Arr[MX];
int main()
{
    int n ,t,cnt=0,k=0,ans=0 ;
    cin >> n >> t ;
    ll sum=0 ;
    for(int i=0;i<n;i++) cin >> Arr[i];
    for(int i=0;i<n;i++)
    {
        sum+=Arr[i];
        cnt++;
        while(sum>t)
        {
            sum-=Arr[k];
            cnt--;
            k++;
        }
        ans=max(ans,cnt);
    }
    cout << ans;
}


#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std ;
vector<int> v ;
int main ()
{
    int n,t;
    cin>>n>>t;
    vector<int> v;
    while(n--)
    {
        int x;
        cin>>x;
        v.push_back(x);
    }
    int res=0,c=0,sum=0,k=0;
    for(int i=0; i<v.size(); i++)
    {
        sum+=v[i];
        c++;
        while(sum>t)
        {
            sum-=v[k];
            c--;
            k++;
        }
        res=max(res,c);
    }
    cout<<res;
}
return 0 ;
}


#include <iostream>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define F first
#define S second
int arr[500111];
int main()
{
    int n,t;
    cin>>n>>t;
    for(int i=0;i<n;i++)cin>>arr[i];
    int l=0 , r=0 , ans=0 , sum=arr[0];
    while(r<n && l<=r)
    {
        //cout<<sum<<"<==sum  ans==> "<<ans<<endl;
        if(sum<=t)
        {
            r++;
            sum+=arr[r];
            ans++;
        }
        else
        {
            ans--;
            sum-=arr[l];
            l++;
        }
    }
    cout<<ans<<endl;
}


#include <iostream>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define F first
#define S second
int arr[500111];
int main()
{
    int n,t;
    cin>>n>>t;
    for(int i=0;i<n;i++)cin>>arr[i];
    int l=0 , r=0 , ans=0 , sum=0, Ans=0;
   // if(sum<=t)ans++;
    while(r<n)
    {
        sum+=arr[r];
        ans++;
        while(sum>t)
        {
            sum-=arr[l];
            l++;
            ans--;
        }
        r++;
        Ans=max(ans,Ans);
    }
    cout<<Ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
long long arr[100010],k,n,ans[100010],mx=0;
void lower(){
    int s=0,e=n,m;
    while(s<e){
        m=s+((e-s+1)/2);
        long long ans=0,b=0;
        for(int i=m;i<n;i++){
            if(ans+arr[i]>k)
                break;
            b++;
            ans+=arr[i];
        }
        if(ans<=mx){
            s=m;
        }
        else
            e=m-1;
        mx=max(mx,b);
    }
    return;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    lower();
    cout<<mx;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int main()
{
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int ans=0,sum=0,mx=0,x=0;
    for(int i=0;i<=n;i++){
        x=0;
        for(int j=i;j<=n;j++){
            if(sum>m)
                break;
            x++;
            sum+=arr[j];
        }
        mx=max(mx,x);
    }
    cout<<mx<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100010],k,n,ans[100010],mx=0;
void lower(){
    int s=0,e=n,m;
    while(s<e){
        m=s+((e-s)/2);
        int ans=0,b=0;
        for(int i=m;i<n;i++){
            if(ans+arr[i]>k)
                break;
            b++;
            ans+=arr[i];
        }
        if(ans<mx){
            s=m+1;
        }
        else
            e=m;
        mx=max(mx,b);
    }
    return;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    lower();
    cout<<mx;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long arr[100010],k,n,ans[100010],mx=0;
void lower(){
    int s=0,e=n,m;
    while(s<e){
        m=s+((e-s)/2);
        long long ans=0,b=0;
        for(int i=m;i<n;i++){
            if(ans+arr[i]>k)
                break;
            b++;
            ans+=arr[i];
        }
        if(ans<=mx){
            s=m;
        }
        else
            e=m;
        mx=max(mx,b);
    }
    return;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    lower();
    cout<<mx;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int csum[100005];
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    for(int i=1;i<=n;i++)
        /*3 3
          2 2 3
        */
        csum[i]=csum[i-1]+arr[n-i];
    for(int i=n;i>=0;i--){
        if(csum[i]<=m){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long arr[100010],k,n,ans[100010],mx=0;
void lower(){
    int s=0,e=n,m;
    while(s<e){
        m=s+((e-s)/2);
        long long ans=0,b=0;
        for(int i=m;i<n;i++){
            if(ans+arr[i]>k)
                break;
            b++;
            ans+=arr[i];
        }
        if(ans<mx){
            s=m;
        }
        else
            e=m-1;
        mx=max(mx,b);
    }
    return;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    lower();
    cout<<mx;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int main()
{
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int ans=0,sum=0,mx=0,x=0;
    for(int i=0;i<n;i++){
        x=0;
        sum=0;
        for(int j=i;j<n;j++){
            x++;
            sum+=arr[j];
            if(sum>m){
                x--;
                break;
            }

            //cout<<j<<" "<<sum<<" "<<x<<endl;
        }
        mx=max(mx,x);
    }
    cout<<mx<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int csum[100005];
int main()
{
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        csum[i+1]=csum[i]+arr[i];
    }
    int ans=0,mx=0,x=0;
    for(int i=0;i<=n;i++){
        x=0;
        for(int j=i;j<=n;j++){
            x++;
            if(csum[j]-csum[i-1]>m){
                x--;
                break;
            }
        }
        mx=max(mx,x);
    }
    cout<<mx<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long arr[100010],k,n,ans[100010],mx=0;
void lower(){
    int s=0,e=n,m;
    while(s<e){
        m=s+((e-s)/2);
        long long ans=0,b=0;
        for(int i=m;i<n;i++){
            if(ans+arr[i]>k)
                break;
            b++;
            ans+=arr[i];
        }
        if(ans<mx){
            s=m+1;
        }
        else
            e=m;
        mx=max(mx,b);
    }
    return;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    lower();
    cout<<mx;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int csum[100005];
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    int sum=0,ans=0;
    for(int i=0;i<n;i++){
        if(sum+arr[i]<=m){
            ans++;
            sum+=arr[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100010],k,n,ans[100010],mx=0;
void lower(){
    int s=1,e=n,m;
    while(s<e){
        m=s+((e-s)/2);
        int ans=0,b=0;
        for(int i=m;i<n;i++){
            if(ans+arr[i]>k)
                break;
            b++;
            ans+=arr[i];
        }
        if(ans<mx){
            s=m+1;
        }
        else
            e=m;
        mx=max(mx,b);
    }
    return;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    lower();
    cout<<mx;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int csum[100005];
int main()
{
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        csum[i+1]=csum[i]+arr[i];
    }
    int sum=0,ans=0,mx=0,x=0;
    for(int i=1;i<=n;i++){
        x=0;
        for(int j=i;j<=n;j++){
            x++;
            if(csum[j]-csum[i-1]>m){
                x--;
            }
        }
        mx=max(mx,x);
    }
    cout<<mx<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long arr[100010],k,n,ans[100010],mx=0;
void lower(){
    int s=0,e=n,m;
    while(s<e){
        m=s+((e-s)/2);
        long long ans=0,b=0;
        for(int i=m;i<n;i++){
            if(ans+arr[i]>k)
                break;
            b++;
            ans+=arr[i];
        }
        if(ans<mx){
            s=m;
        }
        else
            e=m;
        mx=max(mx,b);
    }
    return;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    lower();
    cout<<mx;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long arr[100010],k,n,ans[100010],mx=0;
void lower(){
    int s=0,e=n,m;
    while(s<e){
        m=s+((e-s)/2);
        long long ans=0,b=0;
        for(int i=m;i<n;i++){
            if(ans+arr[i]>k)
                break;
            b++;
            ans+=arr[i];
        }
        if(ans<=mx){
            s=m+1;
        }
        else
            e=m;
        mx=max(mx,b);
    }
    return;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    lower();
    cout<<mx;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int csum[100005];
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        arr[i]*=-1;
    }
    sort(arr,arr+n);
    for(int i=1;i<=n;i++)
        /*3 3
          2 2 3
        */
        csum[i]=csum[i-1]+arr[n-i]*-1;
    for(int i=n;i>=0;i--){
        if(csum[i]<=m){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int main()
{
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int ans=0,sum=0,mx=0,x=0;
    for(int i=0;i<n;i++){
        int y=i;
        for(int j=i;j<n;j++,y++){
            x++;
            sum+=arr[j];
            if(sum>m){
                x--;
                sum-=arr[j];
                break;
            }
            //cout<<j<<" "<<sum<<" "<<x<<endl;
        }
        sum-=arr[i];
        i=y-1;
        mx=max(mx,x);
        x--;
        //cout<<x+1<<" "<<sum+arr[i]<<" "<<i<<endl;
    }
    cout<<mx<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int csum[100005];
int main()
{
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        csum[i+1]=csum[i]+arr[i];
    }
    int ans=0,mx=0,x=0;
    for(int i=0;i<=n;i++){
        x=0;
        for(int j=i;j<=n;j++){
            x++;
            if(csum[j]-csum[i-1]>m){

                break;
            }
        }
        mx=max(mx,x);
    }
    cout<<mx<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int main()
{
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int sum=0,mx=0,x=0;
    /*
    10 15
    10 9 1 1 5 10 5 3 7 2
    */
    for(int i=0;i<n;i++){
        int y=i;
        for(int j=i;j<n;j++,y++){
            x++;
            sum+=arr[j];
            //cout<<y<<" "<<x<<" "<<sum<<" "<<i<<" "<<mx<<endl;
            if(sum>m){
                //cout<<"breaked"<<endl;
                x--;
                sum-=arr[j];
                break;
            }
            //cout<<j<<" "<<sum<<" "<<x<<endl;
        }
        sum-=arr[y-x];
        i=y-1;
        mx=max(mx,x);
        x--;
        //cout<<x+1<<" "<<sum+arr[i]<<" "<<i<<endl;
    }
    cout<<mx<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int csum[100005];
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        csum[i+1]=csum[i]+arr[i];
    }
    int sum=0,ans=0,mx=0,x=0;
    for(int i=1;i<=n;i++){
        x=0;
        for(int j=i;j<=n;j++){
            x++;
            if(csum[j]-csum[i-1]>m){
                x--;
            }
        }
        mx=max(mx,x);
    }
    cout<<mx<<endl;
    return 0;
}


#include<cstdio>
#include<iostream>
using namespace std;
const int Maxn=100000+10,inf=0x3f3f3f3f;
int a[Maxn],s[Maxn];
int n,m,ans;
inline int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0' && ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
int main()
{
//	freopen("in.txt","r",stdin);
	n=read(),m=read();

	for(int i=1;i<=n;++i)
	a[i]=read(),s[i]=s[i-1]+a[i];

	for(int i=1;i<=n;++i)
	{
		if(a[i]>m)continue;
		int l=i,r=n; // find j
		while(l<r)
		{
			int mid=(l+r)>>1;
			mid++;
			if(s[mid]-s[i-1]<=m)l=mid;
			else r=mid-1;
		}
		ans=max(ans,l-i+1); // update the answer
	}
	printf("%d\n",ans);
	return 0;
}


#include <fstream>
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <random>
#include <math.h>
#include <complex>
#include <set>
#include <string>
#include <bitset>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};
//mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

template<class T> bool ckmin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; }
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x))
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down
ll half(ll x) { return fdiv(x,2); }

template<class T, class U> T fstTrue(T lo, T hi, U f) {
    hi ++; assert(lo <= hi); // assuming f is increasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi);
        f(mid) ? hi = mid : lo = mid+1;
    }
    return lo;
}
template<class T, class U> T lstTrue(T lo, T hi, U f) {
    lo --; assert(lo <= hi); // assuming f is decreasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi+1);
        f(mid) ? lo = mid : hi = mid-1;
    }
    return lo;
}
template<class T> void remDup(vector<T>& v) {
    sort(all(v)); v.erase(unique(all(v)),end(v)); }

// INPUT
template<class A> void re(complex<A>& c);
template<class A, class B> void re(pair<A,B>& p);
template<class A> void re(vector<A>& v);
template<class A, size_t SZ> void re(array<A,SZ>& a);

template<class T> void re(T& x) { cin >> x; }
void re(db& d) { str t; re(t); d = stod(t); }
void re(ld& d) { str t; re(t); d = stold(t); }
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }

template<class A> void re(complex<A>& c) { A a,b; re(a,b); c = {a,b}; }
template<class A, class B> void re(pair<A,B>& p) { re(p.f,p.s); }
template<class A> void re(vector<A>& x) { trav(a,x) re(a); }
template<class A, size_t SZ> void re(array<A,SZ>& x) { trav(a,x) re(a); }

// TO_STRING
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
str ts(bool b) {
#ifdef LOCAL
    return b ? "true" : "false";
#else
    return ts((int)b);
#endif
}
template<class A> str ts(complex<A> c) {
    stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) {
    str res = "{"; F0R(i,sz(v)) res += char('0'+v[i]);
    res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) {
    str res = ""; F0R(i,SZ) res += char('0'+b[i]);
    return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { // containers with begin(), end()
#ifdef LOCAL
    bool fst = 1; str res = "{";
		for (const auto& x: v) {
			if (!fst) res += ", ";
			fst = 0; res += ts(x);
		}
		res += "}"; return res;
#else
    bool fst = 1; str res = "";
    for (const auto& x: v) {
        if (!fst) res += " ";
        fst = 0; res += ts(x);
    }
    return res;

#endif
}
template<class A, class B> str ts(pair<A,B> p) {
#ifdef LOCAL
    return "("+ts(p.f)+", "+ts(p.s)+")";
#else
    return ts(p.f)+" "+ts(p.s);
#endif
}

// OUTPUT
template<class A> void pr(A x) { cout << ts(x); }
template<class H, class... T> void pr(const H& h, const T&... t) {
    pr(h); pr(t...); }
void ps() { pr("\n"); } // print w/ spaces
template<class H, class... T> void ps(const H& h, const T&... t) {
    pr(h); if (sizeof...(t)) pr(" "); ps(t...); }

// DEBUG
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << ts(h); if (sizeof...(t)) cerr << ", ";
    DBG(t...); }

#define LOCAL

#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

// FILE I/O
void setIn(str s) { freopen(s.c_str(),"r",stdin); }
void setOut(str s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(str s = "") {
    unsyncIO();
    // cin.exceptions(cin.failbit);
    // throws exception when do smth illegal
    // ex. try to read letter into int
    if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

bool viable(int l, int r, vector<int> arr, int maxTime) {
    if (arr[r] - arr[l] <= maxTime) {
        return true;
    }
    return false;
}

int binarySearch(int l, int r, vector<int> arr, int maxTime) {
    int old = -1;
    while (l <= r) {
        if (old == r) {
            return -1;
        }
        if (viable(l, r, arr, maxTime)) {
            return r;
        }
        else {
            int mid = (l + r)/2;
            old = r;
            r = mid;
        }
    }
    return -1;
}

int longestSequence(vector<int> prefixSum, int maxBooks, int maxTime) {
    int maxCount = 0;
    dbg(maxCount);
    for (int i = 0; i < maxBooks; i++) {
        int j = binarySearch(i, maxBooks, prefixSum, maxTime);
        dbg(i, j, maxCount);
        if (j != -1) {
            maxCount = max(j - i, maxCount);
            //dbg(j, maxCount);
        }
    }
    return maxCount;
}

int main() {
    int n, t;
    re(n, t);

    vector<int> minutes(n);
    vector<int> prefixSum(n + 1);

    F0R(i, n) {
        re(minutes[i]);
        prefixSum[i + 1] = prefixSum[i] + minutes[i];
    }

    int x = longestSequence(prefixSum, n, t);
    pr(x);
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


#include <fstream>
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <random>
#include <math.h>
#include <complex>
#include <set>
#include <string>
#include <bitset>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};
//mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

template<class T> bool ckmin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; }
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x))
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down
ll half(ll x) { return fdiv(x,2); }

template<class T, class U> T fstTrue(T lo, T hi, U f) {
    hi ++; assert(lo <= hi); // assuming f is increasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi);
        f(mid) ? hi = mid : lo = mid+1;
    }
    return lo;
}
template<class T, class U> T lstTrue(T lo, T hi, U f) {
    lo --; assert(lo <= hi); // assuming f is decreasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi+1);
        f(mid) ? lo = mid : hi = mid-1;
    }
    return lo;
}
template<class T> void remDup(vector<T>& v) {
    sort(all(v)); v.erase(unique(all(v)),end(v)); }

// INPUT
template<class A> void re(complex<A>& c);
template<class A, class B> void re(pair<A,B>& p);
template<class A> void re(vector<A>& v);
template<class A, size_t SZ> void re(array<A,SZ>& a);

template<class T> void re(T& x) { cin >> x; }
void re(db& d) { str t; re(t); d = stod(t); }
void re(ld& d) { str t; re(t); d = stold(t); }
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }

template<class A> void re(complex<A>& c) { A a,b; re(a,b); c = {a,b}; }
template<class A, class B> void re(pair<A,B>& p) { re(p.f,p.s); }
template<class A> void re(vector<A>& x) { trav(a,x) re(a); }
template<class A, size_t SZ> void re(array<A,SZ>& x) { trav(a,x) re(a); }

// TO_STRING
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
str ts(bool b) {
#ifdef LOCAL
    return b ? "true" : "false";
#else
    return ts((int)b);
#endif
}
template<class A> str ts(complex<A> c) {
    stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) {
    str res = "{"; F0R(i,sz(v)) res += char('0'+v[i]);
    res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) {
    str res = ""; F0R(i,SZ) res += char('0'+b[i]);
    return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { // containers with begin(), end()
#ifdef LOCAL
    bool fst = 1; str res = "{";
		for (const auto& x: v) {
			if (!fst) res += ", ";
			fst = 0; res += ts(x);
		}
		res += "}"; return res;
#else
    bool fst = 1; str res = "";
    for (const auto& x: v) {
        if (!fst) res += " ";
        fst = 0; res += ts(x);
    }
    return res;

#endif
}
template<class A, class B> str ts(pair<A,B> p) {
#ifdef LOCAL
    return "("+ts(p.f)+", "+ts(p.s)+")";
#else
    return ts(p.f)+" "+ts(p.s);
#endif
}

// OUTPUT
template<class A> void pr(A x) { cout << ts(x); }
template<class H, class... T> void pr(const H& h, const T&... t) {
    pr(h); pr(t...); }
void ps() { pr("\n"); } // print w/ spaces
template<class H, class... T> void ps(const H& h, const T&... t) {
    pr(h); if (sizeof...(t)) pr(" "); ps(t...); }

// DEBUG
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << ts(h); if (sizeof...(t)) cerr << ", ";
    DBG(t...); }

//#define LOCAL

#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

// FILE I/O
void setIn(str s) { freopen(s.c_str(),"r",stdin); }
void setOut(str s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(str s = "") {
    unsyncIO();
    // cin.exceptions(cin.failbit);
    // throws exception when do smth illegal
    // ex. try to read letter into int
    if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

bool viable(int l, int r, vector<int> arr, int maxTime) {
    int sum = 0;
    int x = 0;
    dbg(r);
    for (int i = l; i <= r; i++) {
        sum += arr[i];
        x++;
    }
    if (sum <= maxTime) {
        return true;
    }
    return false;
}

int binarySearch(int l, int r, vector<int> arr, int maxTime) {
    int old = -1;
    while (l <= r) {
        if (old == r) {
            return -1;
        }
        if (viable(l, r, arr, maxTime)) {
            return r;
        }
        else {
            int mid = (l + r)/2;
            old = r;
            r = mid;
        }
    }
    return -1;
}

int longestSequence(vector<int> minutes, int maxBooks, int maxTime) {
    int maxCount = 0;
    dbg(maxCount);
    for (int i = 0; i < maxBooks; i++) {
        int j = binarySearch(i, maxBooks - 1, minutes, maxTime);
        dbg(i, j, maxCount);
        if (j != -1) {
            maxCount = max(j - i + 1, maxCount);
            dbg(j, maxCount);
        }
    }
    return maxCount;
}

int main() {
    int n, t;
    re(n, t);

    vector<int> minutes;
    minutes.resize(n);

    F0R(i, n) {
        re(minutes[i]);
    }

    int x = longestSequence(minutes, n, t);
    pr(x);
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


#include <fstream>
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <random>
#include <math.h>
#include <complex>
#include <set>
#include <string>
#include <bitset>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};
//mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

template<class T> bool ckmin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; }
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x))
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down
ll half(ll x) { return fdiv(x,2); }

template<class T, class U> T fstTrue(T lo, T hi, U f) {
    hi ++; assert(lo <= hi); // assuming f is increasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi);
        f(mid) ? hi = mid : lo = mid+1;
    }
    return lo;
}
template<class T, class U> T lstTrue(T lo, T hi, U f) {
    lo --; assert(lo <= hi); // assuming f is decreasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi+1);
        f(mid) ? lo = mid : hi = mid-1;
    }
    return lo;
}
template<class T> void remDup(vector<T>& v) {
    sort(all(v)); v.erase(unique(all(v)),end(v)); }

// INPUT
template<class A> void re(complex<A>& c);
template<class A, class B> void re(pair<A,B>& p);
template<class A> void re(vector<A>& v);
template<class A, size_t SZ> void re(array<A,SZ>& a);

template<class T> void re(T& x) { cin >> x; }
void re(db& d) { str t; re(t); d = stod(t); }
void re(ld& d) { str t; re(t); d = stold(t); }
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }

template<class A> void re(complex<A>& c) { A a,b; re(a,b); c = {a,b}; }
template<class A, class B> void re(pair<A,B>& p) { re(p.f,p.s); }
template<class A> void re(vector<A>& x) { trav(a,x) re(a); }
template<class A, size_t SZ> void re(array<A,SZ>& x) { trav(a,x) re(a); }

// TO_STRING
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
str ts(bool b) {
#ifdef LOCAL
    return b ? "true" : "false";
#else
    return ts((int)b);
#endif
}
template<class A> str ts(complex<A> c) {
    stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) {
    str res = "{"; F0R(i,sz(v)) res += char('0'+v[i]);
    res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) {
    str res = ""; F0R(i,SZ) res += char('0'+b[i]);
    return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { // containers with begin(), end()
#ifdef LOCAL
    bool fst = 1; str res = "{";
		for (const auto& x: v) {
			if (!fst) res += ", ";
			fst = 0; res += ts(x);
		}
		res += "}"; return res;
#else
    bool fst = 1; str res = "";
    for (const auto& x: v) {
        if (!fst) res += " ";
        fst = 0; res += ts(x);
    }
    return res;

#endif
}
template<class A, class B> str ts(pair<A,B> p) {
#ifdef LOCAL
    return "("+ts(p.f)+", "+ts(p.s)+")";
#else
    return ts(p.f)+" "+ts(p.s);
#endif
}

// OUTPUT
template<class A> void pr(A x) { cout << ts(x); }
template<class H, class... T> void pr(const H& h, const T&... t) {
    pr(h); pr(t...); }
void ps() { pr("\n"); } // print w/ spaces
template<class H, class... T> void ps(const H& h, const T&... t) {
    pr(h); if (sizeof...(t)) pr(" "); ps(t...); }

// DEBUG
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << ts(h); if (sizeof...(t)) cerr << ", ";
    DBG(t...); }

#define LOCAL

#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

// FILE I/O
void setIn(str s) { freopen(s.c_str(),"r",stdin); }
void setOut(str s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(str s = "") {
    unsyncIO();
    // cin.exceptions(cin.failbit);
    // throws exception when do smth illegal
    // ex. try to read letter into int
    if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

int longestSequence(vector<int> minutes, int maxBooks, int maxTime) {
    int i = 0;
    int j = 0;
    int maxCount = 0;
    int time = 0;
    int books = 0;
    while (i < maxBooks && j < maxBooks) {
        dbg(i, j, time);
        if (i > 0) {
            time -= minutes[i - 1];
            books --;
        }
        while (minutes[j] + time <= maxTime && j < maxBooks) {
            books++;
            time += minutes[j];
            j++;
            dbg(books, j, time);
        }
        if (books > maxCount) {
            maxCount = books;
        }
        i++;
        // j++;
    }
    return maxCount;
}

int main() {
    int n, t;
    re(n, t);

    vector<int> minutes;
    minutes.resize(n);

    F0R(i, n) {
        re(minutes[i]);
    }

    pr(longestSequence(minutes, n, t));
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


#include <fstream>
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <random>
#include <math.h>
#include <complex>
#include <set>
#include <string>
#include <bitset>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};
//mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

template<class T> bool ckmin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; }
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x))
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down
ll half(ll x) { return fdiv(x,2); }

template<class T, class U> T fstTrue(T lo, T hi, U f) {
    hi ++; assert(lo <= hi); // assuming f is increasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi);
        f(mid) ? hi = mid : lo = mid+1;
    }
    return lo;
}
template<class T, class U> T lstTrue(T lo, T hi, U f) {
    lo --; assert(lo <= hi); // assuming f is decreasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi+1);
        f(mid) ? lo = mid : hi = mid-1;
    }
    return lo;
}
template<class T> void remDup(vector<T>& v) {
    sort(all(v)); v.erase(unique(all(v)),end(v)); }

// INPUT
template<class A> void re(complex<A>& c);
template<class A, class B> void re(pair<A,B>& p);
template<class A> void re(vector<A>& v);
template<class A, size_t SZ> void re(array<A,SZ>& a);

template<class T> void re(T& x) { cin >> x; }
void re(db& d) { str t; re(t); d = stod(t); }
void re(ld& d) { str t; re(t); d = stold(t); }
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }

template<class A> void re(complex<A>& c) { A a,b; re(a,b); c = {a,b}; }
template<class A, class B> void re(pair<A,B>& p) { re(p.f,p.s); }
template<class A> void re(vector<A>& x) { trav(a,x) re(a); }
template<class A, size_t SZ> void re(array<A,SZ>& x) { trav(a,x) re(a); }

// TO_STRING
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
str ts(bool b) {
#ifdef LOCAL
    return b ? "true" : "false";
#else
    return ts((int)b);
#endif
}
template<class A> str ts(complex<A> c) {
    stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) {
    str res = "{"; F0R(i,sz(v)) res += char('0'+v[i]);
    res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) {
    str res = ""; F0R(i,SZ) res += char('0'+b[i]);
    return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { // containers with begin(), end()
#ifdef LOCAL
    bool fst = 1; str res = "{";
		for (const auto& x: v) {
			if (!fst) res += ", ";
			fst = 0; res += ts(x);
		}
		res += "}"; return res;
#else
    bool fst = 1; str res = "";
    for (const auto& x: v) {
        if (!fst) res += " ";
        fst = 0; res += ts(x);
    }
    return res;

#endif
}
template<class A, class B> str ts(pair<A,B> p) {
#ifdef LOCAL
    return "("+ts(p.f)+", "+ts(p.s)+")";
#else
    return ts(p.f)+" "+ts(p.s);
#endif
}

// OUTPUT
template<class A> void pr(A x) { cout << ts(x); }
template<class H, class... T> void pr(const H& h, const T&... t) {
    pr(h); pr(t...); }
void ps() { pr("\n"); } // print w/ spaces
template<class H, class... T> void ps(const H& h, const T&... t) {
    pr(h); if (sizeof...(t)) pr(" "); ps(t...); }

// DEBUG
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << ts(h); if (sizeof...(t)) cerr << ", ";
    DBG(t...); }

    #define LOCAL

#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

// FILE I/O
void setIn(str s) { freopen(s.c_str(),"r",stdin); }
void setOut(str s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(str s = "") {
    unsyncIO();
    // cin.exceptions(cin.failbit);
    // throws exception when do smth illegal
    // ex. try to read letter into int
    if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

int binarySearch(int l, int r, vector<int> arr, int maxTime) {
    while(l<r)
    {
        int mid=(l+r)>>1;
        mid++;
        if(arr[mid] - arr[l] <= maxTime) {
            l = mid;
        }
        else r=mid-1;
    }
    return l;
}

int longestSequence(vector<int> prefixSum, int maxBooks, int maxTime) {
    int maxCount = 0;
    dbg(maxCount);
    for (int i = 0; i < maxBooks; i++) {
        int j = binarySearch(i, maxBooks, prefixSum, maxTime);
        dbg(i, j, maxCount);
        if (j != -1) {
            maxCount = max(j - i, maxCount);
            //dbg(j, maxCount);
        }
    }
    return maxCount;
}

int main() {
    int n, t;
    re(n, t);

    vector<int> minutes(n,0);
    vector<int> prefixSum(n + 1,0);

    F0R(i, n) {
        re(minutes[i]);
        prefixSum[i + 1] = prefixSum[i] + minutes[i];
    }

    int x = longestSequence(prefixSum, n, t);
    pr(x);
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


#include <fstream>
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <random>
#include <math.h>
#include <complex>
#include <set>
#include <string>
#include <bitset>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};
//mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

template<class T> bool ckmin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; }
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x))
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down
ll half(ll x) { return fdiv(x,2); }

template<class T, class U> T fstTrue(T lo, T hi, U f) {
    hi ++; assert(lo <= hi); // assuming f is increasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi);
        f(mid) ? hi = mid : lo = mid+1;
    }
    return lo;
}
template<class T, class U> T lstTrue(T lo, T hi, U f) {
    lo --; assert(lo <= hi); // assuming f is decreasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi+1);
        f(mid) ? lo = mid : hi = mid-1;
    }
    return lo;
}
template<class T> void remDup(vector<T>& v) {
    sort(all(v)); v.erase(unique(all(v)),end(v)); }

// INPUT
template<class A> void re(complex<A>& c);
template<class A, class B> void re(pair<A,B>& p);
template<class A> void re(vector<A>& v);
template<class A, size_t SZ> void re(array<A,SZ>& a);

template<class T> void re(T& x) { cin >> x; }
void re(db& d) { str t; re(t); d = stod(t); }
void re(ld& d) { str t; re(t); d = stold(t); }
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }

template<class A> void re(complex<A>& c) { A a,b; re(a,b); c = {a,b}; }
template<class A, class B> void re(pair<A,B>& p) { re(p.f,p.s); }
template<class A> void re(vector<A>& x) { trav(a,x) re(a); }
template<class A, size_t SZ> void re(array<A,SZ>& x) { trav(a,x) re(a); }

// TO_STRING
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
str ts(bool b) {
#ifdef LOCAL
    return b ? "true" : "false";
#else
    return ts((int)b);
#endif
}
template<class A> str ts(complex<A> c) {
    stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) {
    str res = "{"; F0R(i,sz(v)) res += char('0'+v[i]);
    res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) {
    str res = ""; F0R(i,SZ) res += char('0'+b[i]);
    return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { // containers with begin(), end()
#ifdef LOCAL
    bool fst = 1; str res = "{";
		for (const auto& x: v) {
			if (!fst) res += ", ";
			fst = 0; res += ts(x);
		}
		res += "}"; return res;
#else
    bool fst = 1; str res = "";
    for (const auto& x: v) {
        if (!fst) res += " ";
        fst = 0; res += ts(x);
    }
    return res;

#endif
}
template<class A, class B> str ts(pair<A,B> p) {
#ifdef LOCAL
    return "("+ts(p.f)+", "+ts(p.s)+")";
#else
    return ts(p.f)+" "+ts(p.s);
#endif
}

// OUTPUT
template<class A> void pr(A x) { cout << ts(x); }
template<class H, class... T> void pr(const H& h, const T&... t) {
    pr(h); pr(t...); }
void ps() { pr("\n"); } // print w/ spaces
template<class H, class... T> void ps(const H& h, const T&... t) {
    pr(h); if (sizeof...(t)) pr(" "); ps(t...); }

// DEBUG
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << ts(h); if (sizeof...(t)) cerr << ", ";
    DBG(t...); }

#define LOCAL

#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

// FILE I/O
void setIn(str s) { freopen(s.c_str(),"r",stdin); }
void setOut(str s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(str s = "") {
    unsyncIO();
    // cin.exceptions(cin.failbit);
    // throws exception when do smth illegal
    // ex. try to read letter into int
    if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

bool viable(int l, int r, vector<int> arr, int maxTime) {
    int sum = 0;
    int x = 0;
    dbg(r);
    for (int i = l; i <= r; i++) {
        sum += arr[i];
        x++;
    }
    if (sum <= maxTime) {
        return true;
    }
    return false;
}

int binarySearch(int l, int r, vector<int> arr, int maxTime) {
    int old = -1;
    while (l <= r) {
        if (old == r) {
            return r;
        }
        if (viable(l, r, arr, maxTime)) {
            return r;
        }
        else {
            int mid = (l + r)/2;
            r = mid;
            old = r;
        }
    }
    return -1;
}

int longestSequence(vector<int> minutes, int maxBooks, int maxTime) {
    int maxCount = 0;
    dbg(maxCount);
    for (int i = 0; i < maxBooks; i++) {
        int j = binarySearch(i, maxBooks - 1, minutes, maxTime);
        dbg(i, j, maxCount);
        if (j != -1) {
            maxCount = max(j - i + 1, maxCount);
            dbg(j, maxCount);
        }
    }
    return maxCount;
}

int main() {
    int n, t;
    re(n, t);

    vector<int> minutes;
    minutes.resize(n);

    F0R(i, n) {
        re(minutes[i]);
    }

    int x = longestSequence(minutes, n, t);
    pr(x);
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


#include <fstream>
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <random>
#include <math.h>
#include <complex>
#include <set>
#include <string>
#include <bitset>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};
//mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

template<class T> bool ckmin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; }
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x))
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down
ll half(ll x) { return fdiv(x,2); }

template<class T, class U> T fstTrue(T lo, T hi, U f) {
    hi ++; assert(lo <= hi); // assuming f is increasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi);
        f(mid) ? hi = mid : lo = mid+1;
    }
    return lo;
}
template<class T, class U> T lstTrue(T lo, T hi, U f) {
    lo --; assert(lo <= hi); // assuming f is decreasing
    while (lo < hi) { // find first index such that f is true
        T mid = half(lo+hi+1);
        f(mid) ? lo = mid : hi = mid-1;
    }
    return lo;
}
template<class T> void remDup(vector<T>& v) {
    sort(all(v)); v.erase(unique(all(v)),end(v)); }

// INPUT
template<class A> void re(complex<A>& c);
template<class A, class B> void re(pair<A,B>& p);
template<class A> void re(vector<A>& v);
template<class A, size_t SZ> void re(array<A,SZ>& a);

template<class T> void re(T& x) { cin >> x; }
void re(db& d) { str t; re(t); d = stod(t); }
void re(ld& d) { str t; re(t); d = stold(t); }
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }

template<class A> void re(complex<A>& c) { A a,b; re(a,b); c = {a,b}; }
template<class A, class B> void re(pair<A,B>& p) { re(p.f,p.s); }
template<class A> void re(vector<A>& x) { trav(a,x) re(a); }
template<class A, size_t SZ> void re(array<A,SZ>& x) { trav(a,x) re(a); }

// TO_STRING
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
str ts(bool b) {
#ifdef LOCAL
    return b ? "true" : "false";
#else
    return ts((int)b);
#endif
}
template<class A> str ts(complex<A> c) {
    stringstream ss; ss << c; return ss.str(); }
str ts(vector<bool> v) {
    str res = "{"; F0R(i,sz(v)) res += char('0'+v[i]);
    res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) {
    str res = ""; F0R(i,SZ) res += char('0'+b[i]);
    return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { // containers with begin(), end()
#ifdef LOCAL
    bool fst = 1; str res = "{";
		for (const auto& x: v) {
			if (!fst) res += ", ";
			fst = 0; res += ts(x);
		}
		res += "}"; return res;
#else
    bool fst = 1; str res = "";
    for (const auto& x: v) {
        if (!fst) res += " ";
        fst = 0; res += ts(x);
    }
    return res;

#endif
}
template<class A, class B> str ts(pair<A,B> p) {
#ifdef LOCAL
    return "("+ts(p.f)+", "+ts(p.s)+")";
#else
    return ts(p.f)+" "+ts(p.s);
#endif
}

// OUTPUT
template<class A> void pr(A x) { cout << ts(x); }
template<class H, class... T> void pr(const H& h, const T&... t) {
    pr(h); pr(t...); }
void ps() { pr("\n"); } // print w/ spaces
template<class H, class... T> void ps(const H& h, const T&... t) {
    pr(h); if (sizeof...(t)) pr(" "); ps(t...); }

// DEBUG
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << ts(h); if (sizeof...(t)) cerr << ", ";
    DBG(t...); }

#define LOCAL

#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

// FILE I/O
void setIn(str s) { freopen(s.c_str(),"r",stdin); }
void setOut(str s) { freopen(s.c_str(),"w",stdout); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
void setIO(str s = "") {
    unsyncIO();
    // cin.exceptions(cin.failbit);
    // throws exception when do smth illegal
    // ex. try to read letter into int
    if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

bool viable(int l, int r, vector<int> arr, int maxTime) {
    int sum = 0;
    int x = 0;
    dbg(r);
    for (int i = l; i <= r; i++) {
        sum += arr[i];
        x++;
    }
    if (sum <= maxTime) {
        return true;
    }
    return false;
}

int binarySearch(int l, int r, vector<int> arr, int maxTime) {
    while (l <= r) {
        if (viable(l, r, arr, maxTime)) {
            return r;
        }
        else {
            int mid = (l + r)/2;
            r = mid;
        }
    }
    return -1;
}

int longestSequence(vector<int> minutes, int maxBooks, int maxTime) {
    int maxCount = 0;
    dbg(maxCount);
    for (int i = 0; i < maxBooks; i++) {
        int j = binarySearch(i, maxBooks - 1, minutes, maxTime);
        dbg(i, j, maxCount);
        if (j != -1) {
            maxCount = max(j - i + 1, maxCount);
            dbg(j, maxCount);
        }
    }
    return maxCount;
}

int main() {
    int n, t;
    re(n, t);

    vector<int> minutes;
    minutes.resize(n);

    F0R(i, n) {
        re(minutes[i]);
    }

    int x = longestSequence(minutes, n, t);
    pr(x);
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/