n,m=map(int,input().strip().split())
a=list(map(int,input().strip().split()))
#4 5
#3 1 2 1
#find max number of books can read
ans=0
l=0
sum=0
for i in range(n):
sum+=a[i]
if sum<=m:
ans+=1
else:
sum-=a[l]
l+=1
print(ans)
bixtPW1hcChpbnQsaW5wdXQoKS5zdHJpcCgpLnNwbGl0KCkpCmE9bGlzdChtYXAoaW50LGlucHV0KCkuc3RyaXAoKS5zcGxpdCgpKSkKIAojNCA1CiMzIDEgMiAxCiNmaW5kIG1heCBudW1iZXIgb2YgYm9va3MgY2FuIHJlYWQKIAphbnM9MApsPTAKc3VtPTAKIApmb3IgaSBpbiByYW5nZShuKToKCXN1bSs9YVtpXQoJaWYgc3VtPD1tOgoJCWFucys9MQoJZWxzZToKCQlzdW0tPWFbbF0KCQlsKz0xCnByaW50KGFucyk=