#include <iostream>
using namespace std;
#include <bits/stdc++.h>
int main() {
// your code goes here
vector<int>arr={1,2,3,4,5,6};
int k=10;
int i=0,j=0;
int n=arr.size();
int sum=0;
int max_length=0;
int current_length;
while(i<n && j<n)
{
sum+=arr[j];
while(sum>k)
{
sum=sum-arr[i];
i++;
}
current_length=(j-i+1);
max_length=max(current_length,max_length);
j++;
}
cout<<max_length;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KCmludCBtYWluKCkgewoJLy8geW91ciBjb2RlIGdvZXMgaGVyZQoKICAgIHZlY3RvcjxpbnQ+YXJyPXsxLDIsMyw0LDUsNn07CiAgICBpbnQgaz0xMDsKICAgIGludCBpPTAsaj0wOwogICAgaW50IG49YXJyLnNpemUoKTsKICAgIGludCBzdW09MDsKICAgIGludCBtYXhfbGVuZ3RoPTA7CiAgICBpbnQgY3VycmVudF9sZW5ndGg7CiAgICB3aGlsZShpPG4gJiYgajxuKQogICAgICB7CiAgICAgIAlzdW0rPWFycltqXTsKICAgICAgCXdoaWxlKHN1bT5rKQogICAgICAJIHsKICAgICAgCSAJc3VtPXN1bS1hcnJbaV07CiAgICAgIAkgCWkrKzsKICAgICAgCSB9CiAgICAgIAkgY3VycmVudF9sZW5ndGg9KGotaSsxKTsKICAgICAgCSBtYXhfbGVuZ3RoPW1heChjdXJyZW50X2xlbmd0aCxtYXhfbGVuZ3RoKTsKICAgICAgCSBqKys7CiAgICAgIH0KICAgICAgY291dDw8bWF4X2xlbmd0aDsKCXJldHVybiAwOwp9