#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll n,x; cin>>n>>x; vector A(n); ll sum=0; rep(i,n){ cin>>A[i]; sum+=A[i]; } if(sum<=x){ cout< B(2*n); rep(i,n) B[i]=A[i],B[i+n]=A[i]; vector S(2*n+1); rep(i,2*n) S[i+1]=S[i]+B[i]; ll ma=0; rep(i,n){ auto r=upper_bound(ALL(S),S[i]+x)-S.begin(); ma=max(ma,S[r-1]-S[i]); } cout<