#include<iostream>
#include<cstdio>
using namespace std;

int n,m;
int s,e;
int tot=0;
int ans=0;
int h[250000]={0};

char ch;
int ret;
int qin()
{
	ret=0;
	while(ch=getchar(),!isdigit(ch));
	while(ret=ret*10+ch-'0',ch=getchar(),isdigit(ch));
	return ret;
}

void work()
{
	s=1;
	e=0;
	tot=0;
	ans=0;
	for(int i=1;i<=n;++i)
	{
		e++;
		h[i]=qin();
		tot+=h[i];
		while(tot>=m)
		{
			if(ans==0||e-s+1<ans)
			{
				ans=e-s+1;
			}
			tot-=h[s];
			s++;
		}
	}
	printf("%d",ans);
}

int main()
{
    scanf("%d%d",&n,&m);
    work();
    while(scanf("%d%d",&n,&m)!=EOF)
    {
		printf("\n");
		work();
	}
    return 0;
}
/**************************************************************
	Problem: 2105
	User: admin
	Language: C++
	Result: Accepted
	Time:44 ms
	Memory:3052 kb
****************************************************************/