#include <bits/stdc++.h> using namespace std; const long long N = 4 * 1e6; priority_queue<int, vector, greater > qu; int l[N]; queueq; int main(){ long long n, m; cin >> n >> m; for(int i=1;i<=n;i++){ cin >> l[i]; } long long sum = 0, max1 = 0, lf = 1, r = 1, ml, mr; for(int i=1;i<=n;i++){ if(sum + l[i] > m){ while(sum + l[i] > m){ sum -= q.front(); q.pop(); lf++; } } q.push(l[i]); sum+=l[i]; r++; if(max1 < sum){ max1 = sum; ml = lf; mr = r-1; } } cout << ml << " " << mr << " " << max1 << endl; }