#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

long long i, i1, j, k, k1, t, n, m, res, check1, check2, a, b, c, u, v, w, p[400010], dist[200010][3], ps[200010];
vector<long long> adj[200010];
queue<long long> q;
bool visited[200010];

void bfs(int s, int o) {
    for (i = 1; i <= n; i++) {
        visited[i] = false;
    }
    dist[s][o] = 0;
    visited[s] = true;
    q.push(s);
    while (!q.empty()) {
        v = q.front(); q.pop();
        for (auto u : adj[v]) {
            if (!visited[u]) {
                q.push(u);
                visited[u] = true;
                dist[u][o] = dist[v][o] + 1;
            }
        }
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    //ifstream cin("input.txt");
    //ofstream cout("output.txt");

    cin >> t;
    while (t--) {
        cin >> n >> m >> a >> b >> c;
        p[0] = 0;
        for (i = 0; i < m; i++) {
            cin >> p[i + 1];
        }
        for (i = 1; i <= n; i++) {
            adj[i].clear();
        }
        for (i = 0; i < m; i++) {
            cin >> u >> v;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }

        sort(p + 1, p + m + 1);
        for (i = m + 1; i < 400010; i++) {
            p[i] = (long long)1e18;
        }
        ps[0] = p[0];
        for (i = 1; i <= m; i++) {
            ps[i] = ps[i - 1] + p[i];
        }

        /* for (i = 1; i <= m; i++) {
            cout << ps[i] << ' ';
        }
        cout << endl; */

        bfs(a, 0); bfs(b, 1); bfs(c, 2);

        res = (long long)1e18;
        for (i = 1; i <= n; i++) {
            if (dist[i][0] + dist[i][1] + dist[i][2] + (i != b) > dist[a][1] + dist[b][2]) {
                continue;
            }
            check1 = -2;
            check2 = -2;
            for (auto u : adj[i]) {
                if (dist[u][0] == dist[i][0] - 1) {
                    if (check1 == -2) {
                        check1 = u;
                    } else {
                        check1 = -1;
                    }
                }
                if (dist[u][2] == dist[i][2] - 1) {
                    if (check2 == -2) {
                        check2 = u;
                    } else {
                        check2 = -1;
                    }
                }
            }
            if (check1 >= 0 && check2 == check1) {
                continue;
            }

            // cout << i << ' ' << ps[dist[i][1]] + ps[dist[i][0] + dist[i][1] + dist[i][2]] << endl;
            // cout << dist[i][0] << ' ' << dist[i][1] << ' ' << dist[i][2] << endl;
            res = min(res, ps[dist[i][1]] + ps[dist[i][0] + dist[i][1] + dist[i][2]]);
        }

        cout << res << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

long long i, i1, j, k, k1, t, n, m, res, check1, check2, a, b, c, u, v, w, p[200010], dist[200010][3], ps[200010];
vector<long long> adj[200010];
queue<long long> q;
bool visited[200010];

void bfs(int s, int o) {
    for (i = 1; i <= n; i++) {
        visited[i] = false;
    }
    dist[s][o] = 0;
    visited[s] = true;
    q.push(s);
    while (!q.empty()) {
        v = q.front(); q.pop();
        for (auto u : adj[v]) {
            if (!visited[u]) {
                q.push(u);
                visited[u] = true;
                dist[u][o] = dist[v][o] + 1;
            }
        }
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    //ifstream cin("input.txt");
    //ofstream cout("output.txt");

    cin >> t;
    while (t--) {
        cin >> n >> m >> a >> b >> c;
        p[0] = 0;
        for (i = 0; i < m; i++) {
            cin >> p[i + 1];
        }
        for (i = 0; i < m; i++) {
            cin >> u >> v;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }

        sort(p + 1, p + m + 1);
        ps[0] = p[0];
        for (i = 1; i <= m; i++) {
            ps[i] = ps[i - 1] + p[i];
        }

        /* for (i = 1; i <= m; i++) {
            cout << ps[i] << ' ';
        }
        cout << endl; */

        bfs(a, 0); bfs(b, 1); bfs(c, 2);

        res = (long long)1e18;
        for (i = 1; i <= n; i++) {
            if (dist[i][0] + dist[i][1] + dist[i][2] + (i != b) > dist[a][1] + dist[b][2]) {
                continue;
            }
            check1 = -2;
            check2 = -2;
            for (auto u : adj[i]) {
                if (dist[u][0] == dist[i][0] - 1) {
                    if (check1 == -2) {
                        check1 = u;
                    } else {
                        check1 = -1;
                    }
                }
                if (dist[u][2] == dist[i][2] - 1) {
                    if (check2 == -2) {
                        check2 = u;
                    } else {
                        check2 = -1;
                    }
                }
            }
            if (check1 >= 0 && check2 == check1) {
                continue;
            }

            // cout << i << ' ' << ps[dist[i][1]] + ps[dist[i][0] + dist[i][1] + dist[i][2]] << endl;
            // cout << dist[i][0] << ' ' << dist[i][1] << ' ' << dist[i][2] << endl;
            res = min(res, ps[dist[i][1]] + ps[dist[i][0] + dist[i][1] + dist[i][2]]);
        }

        cout << res << endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

long long int n;
long long int a[100010];
long long int s;

long long int check(int mid){
    long long int b[n]={0};
    long long int sum=0;
    for(int i=0;i<n;i++){
        b[i]=a[i]+(i+1)*mid;
    }
    sort(b,b+n);
    for(int i=0;i<mid;i++){
        sum+=b[i];
    }
    return sum;
}

void binarysearch(int low,int high){
    while(low<high-1){
        int mid=(low+high)/2;
        if(check(mid)<=s){
            low=mid;
        }
        else{
            high=mid;
        }
    }
    cout<<low<<" "<<check(low);
}

int main()
{
    cin>>n;
    cin>>s;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    binarysearch(0,n+1);
}


#include<bits/stdc++.h>
using namespace std;

long long n;
long long a[100010];
long long s;

long long check(int mid){
    long long b[n]={0};
    long long sum=0ll;;
    for(int i=0;i<n;i++){
        b[i]=a[i]+(i+1)*mid;
    }
    sort(b,b+n);
    for(int i=0;i<mid;i++){
        sum+=b[i];
    }
    return sum;
}

void binarysearch(int low,int high){
    while(low<high-1){
        int mid=(low+high)/2;
        if(check(mid)<=s){
            low=mid;
        }
        else{
            high=mid;
        }
    }
    cout<<low<<" "<<check(low);
}

int main()
{
    cin>>n;
    cin>>s;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    binarysearch(0,n+1);
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// max element in a vector --> maxelement
// count ... returns a number of time an element occurs in any array or vector  count ( a, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n; ll s;
	cin >> n >> s;
	intvector v(n+1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n,  mid;
	ll cost;
	ll maxitems = 0;
	ll sum;
	while (low <= high)
	{
		mid = low + (high-low)/2;
		intvector check = v;
		sort(check.begin() + 1, check.end());
		sum = 0;
		for (int i = 1; i <= mid; i++)
		{
			sum += check[i] + i * mid;
		}

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n; ll s;
	cin >> n >> s;
	intvector v(n+1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n,  mid;
	ll cost;
	ll maxitems = 0;
	ll sum = 0;
	while (low <= high)
	{
		mid = low + (high-low)/2;
		intvector check = v;
		sort(check.begin() + 1, check.end());
		sum = 0;
		for (int i = 1; i <= mid; i++)
		{
			sum += check[i] + i * mid;
		}

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int N, S;
intvector arr;

ll f(int k)
{
	vector<int>v(N+1);
	for (int i = 1; i <= N; i++) v[i] = arr[i] + (i)*k;
	sort(v.begin()+1 , v.end());
	ll sum = 0;
	for (int i = 1; i <= k; i++) sum += v[i];
	if (sum <= S) return sum;
	return -1;
}

int main()
{
	fast;
	cin >> N >> S;
	arr.resize(N + 1);
	for (int i = 1; i <= N; i++) cin >> arr[i];

	ll lo = 1, hi = N, ans = 0, cost = 0, mid, y;

	while (lo <= hi)
	{
		mid = lo + (hi - lo) / 2;
		y = f(mid);
		if (y < 0) hi = mid - 1;
		else { ans = mid; cost = y; lo = mid + 1; }
	}
	cout << ans << space << cost << endl;
	return 0;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n; ll s;
	cin >> n >> s;
	intvector v(n + 1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n, mid;
	ll cost = 0;
	ll maxitems = 0;
	ll sum = 0;

	while (low <= high)
	{
		mid = (low + high ) / 2;
		intvector check = v;
		sum = 0;
		for (int i = 1; i <= n; i++)
		{
			check[i] = check[i] + (i * mid);
		}
		sort(check.begin() + 1, check.end());

		for (int i = 1; i <= mid; i++)	sum += check[i];

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n, s;
	cin >> n >> s;
	intvector v(n + 1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n, mid;
	ll cost = 0;
	ll maxitems = 0;
	ll sum = 0;

	while (low <= high)
	{
		mid = (low + high ) / 2;
		intvector check = v;
		sum = 0;
		for (int i = 1; i <= n; i++)
		{
			check[i] = check[i] + (i * mid);
		}

		sort(check.begin() + 1, check.end());

		for (int i = 1; i <= mid; i++)	sum += check[i];

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n; ll s;
	cin >> n >> s;
	intvector v(n+1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n,  mid;
	ll cost =0 ;
	ll maxitems = 0;
	ll sum = 0;
	while (low <= high)
	{
		mid = low + (high-low)/2;
		intvector check = v;
		sort(check.begin() + 1, check.end());
		sum = 0;
		for (int i = 1; i <= mid; i++)
		{
			sum += check[i] + i * mid;
		}

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n; ll s;
	cin >> n >> s;
	intvector v(n+1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n,  mid;
	ll cost =0 ;
	ll maxitems = 0;
	ll sum = 0;
	while (low <= high)
	{
		mid = (low + high)/2;
		intvector check = v;
		sort(check.begin() + 1, check.end());
		sum = 0;
		for (int i = 1; i <= mid; i++)
		{
			sum += check[i] + i * mid;
		}

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n; ll s;
	cin >> n >> s;
	llvector v(n + 1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n, mid;
	ll cost = 0;
	ll maxitems = 0;
	ll sum = 0;

	while (low <= high)
	{
		mid = (low + high ) / 2;
		llvector check = v;
		sum = 0;
		for (int i = 1; i <= n; i++)
		{
			check[i] = check[i] + (i * mid);
		}

		sort(check.begin() + 1, check.end());

		for (int i = 1; i <= mid; i++)	sum += check[i];

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// max element in a vector --> maxelement
// count ... returns a number of time an element occurs in any array or vector  count ( a, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n; ll s;
	cin >> n >> s;
	intvector v(n+1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n,  mid;
	ll cost;
	ll maxitems = 0;
	ll sum;
	while (low <= high)
	{
		mid = (low+high) overtwo;

		intvector check = v;
		sort(check.begin() + 1, check.end());
		sum = 0;
		for (int i = 1; i <= mid; i++)
		{
			sum += check[i] + i * mid;
		}

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << space << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int N, S;
intvector arr;

ll f(int k)
{
	vector<int>v(N+1);
	for (int i = 1; i <= N; i++) v[i] = arr[i] + (i)*k;
	sort(v.begin()+1 , v.end());
	ll sum = 0;
	for (int i = 1; i <= k; i++) sum += v[i];
	if (sum <= S) return sum;
	return -1;
}

int main()
{
	fast;
	cin >> N >> S;
	arr.resize(N + 1);
	for (int i = 1; i <= N; i++) cin >> arr[i];

	ll lo = 0, hi = N, ans = 0, cost = 0, mid, y;

	while (lo <= hi)
	{
		mid = lo + (hi - lo) / 2;
		y = f(mid);
		if (y < 0) hi = mid - 1;
		else { ans = mid; cost = y; lo = mid + 1; }
	}
	cout << ans << ' ' << cost << '\n';
	return 0;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n, s;
	cin >> n >> s;
	llvector v(n + 1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n, mid;
	ll cost = 0;
	ll maxitems = 0;
	ll sum = 0;

	while (low <= high)
	{
		mid = (low + high ) / 2;
		llvector check = v;
		sum = 0;
		for (int i = 1; i <= n; i++)
		{
			check[i] = check[i] + (i * mid);
		}

		sort(check.begin() + 1, check.end());

		for (int i = 1; i <= mid; i++)	sum += check[i];

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int N, S;
int arr[100005];

ll f(int k)
{
	vector<int>v(N+1);
	for (int i = 1; i <= N; i++) v[i] = arr[i-1] + (i)*k;
	sort(v.begin()+1 , v.end());
	ll sum = 0;
	for (int i = 1; i <= k; i++) sum += v[i];
	if (sum <= S) return sum;
	return -1;
}

int main()
{
	fast;
	cin >> N >> S;
	for (int i = 0; i < N; i++) cin >> arr[i];

	ll lo = 0, hi = N, ans = 0, cost = 0, mid, y;

	while (lo <= hi)
	{
		mid = lo + (hi - lo) / 2;
		y = f(mid);
		if (y < 0) hi = mid - 1;
		else { ans = mid; cost = y; lo = mid + 1; }
	}
	cout << ans << ' ' << cost << '\n';
	return 0;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n; ll s;
	cin >> n >> s;
	intvector v(n + 1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 0, high = n, mid;
	ll cost = 0;
	ll maxitems = 0;
	ll sum = 0;
	while (low <= high)
	{
		mid = (low + high ) / 2;
		intvector check = v;
		sum = 0;
		for (int i = 1; i <= mid; i++)
		{
			sum += check[i] + (i * mid);
		}
		sort(check.begin() + 1, check.end());

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n; ll s;
	cin >> n >> s;
	intvector v(n + 1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n, mid;
	ll cost = 0;
	ll maxitems = 0;
	ll sum = 0;
	while (low <= high)
	{
		mid = (low + high ) / 2;
		intvector check = v;
		sum = 0;
		for (int i = 1; i <= mid; i++)
		{
			sum += check[i] + (i * mid);
		}
		sort(check.begin() + 1, check.end());

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n; ll s;
	cin >> n >> s;
	llvector v(n + 1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n, mid;
	ll cost = 0;
	ll maxitems = 0;
	ll sum = 0;

	while (low <= high)
	{
		mid = (low + high ) / 2;
		intvector check = v;
		sum = 0;
		for (int i = 1; i <= n; i++)
		{
			check[i] = check[i] + (i * mid);
		}

		sort(check.begin() + 1, check.end());

		for (int i = 1; i <= mid; i++)	sum += check[i];

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair <int, int> intpair;
#define longlongvector vector<long long>
#define llvector vector<long long>
typedef long long ll;
#define pause system("pause")
#define overtwo >> 1
#define intvector vector<int>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define reverseall(x) reverse(all(x))
#define size size()
#define ever for(;;)
#define isnotempty(s) !s.empty()
#define space " "
// count ... returns a number of time an element occurs in any array or vector  count ( a.begin, a.end, item )
// lowerebound --> first equal or greater than
// you can memeset a 2d char array....
// a pair is sorted according to its first
// sort(v.rbegin(), v.rend()-1);
// best practice strategy dealing with string creation or manipulation is to use a char array when needed.
string yes[3] = { "YES", "Yes", "yes" };
string no[3] = { "NO", "No", "no" };
#define inf 0x3f3f3f3f
// loop through a map for (auto const& x : mp)
int countones(int a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
int countones(ll a) { int count = 0; while (a != 0) { count++; a = a & (a - 1); } return count; }
unsigned int reverse_bits(register unsigned int x) { x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1)); x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2)); x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4)); x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8)); return((x >> 16) | (x << 16)); }
#define here cout<<"here"<<endl;
#define maxelement(x) *max_element(all(x));

int main()
{
	int n; ll s;
	cin >> n >> s;
	intvector v(n + 1);
	for (int i = 1; i <= n; i++) cin >> v[i];

	int low = 1, high = n, mid;
	ll cost = 0;
	ll maxitems = 0;
	ll sum = 0;

	while (low <= high)
	{
		mid = (low + (high-low) ) / 2;
		intvector check = v;
		sum = 0;
		for (int i = 1; i <= mid; i++)
		{
			check[i] = check[i] + (i * mid);
		}
		sort(check.begin() + 1, check.end());

		for (int i = 0; i < s; i++)
			sum += check[i+1];

		if (sum > s)
		{
			high = mid - 1;
		}
		else
		{
			maxitems = mid;
			cost = sum;
			low = mid + 1;
		}
	}

	cout << maxitems << " " << cost << endl;
}


/**
 * code generated by JHelper
 * More info: https://g...content-available-to-author-only...b.com/AlexeyDmitriev/JHelper
 * @author gainullin.ildar
 */

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>

using namespace std;

typedef long long ll;

const int N = 1e5 + 7;

int n, S;
int a[N];
ll b[N];

ll res(int k)
{
    for (int i = 0; i < n; i++)
    {
        b[i] = a[i] + (i + 1) * (ll) k;
    }

    ll ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans += b[i];
    }
    return ans;
}

class Main
{
public:
    void solve(std::istream &in, std::ostream &out)
    {
        in >> n >> S;
        for (int i = 0; i < n; i++)
        {
            in >> a[i];
        }
        int l = 0, r = n + 1;
        while (l < r - 1)
        {
            int m = (l + r) / 2;
            if (res(m) <= S)
            {
                l = m;
            }
            else
            {
                r = m;
            }
        }
        out << l << ' ' << res(l) << '\n';
    }
};

int main()
{
    ios::sync_with_stdio(0);
    Main solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n ;
	long long S;
	cin >> n >> S ;
	vector <long long > sum(n) ;
	vector <int> a(n);

	for(int i=0; i<n; i++)
	{
		cin >> a[i];
	}

	//sort(a.begin(), a.end());

	/*for(int i=0; i<n; i++)
	{
		cout << a[i] << " ";
	}
	*/
	sum[0] = a[0];
	for(int i=1; i<n; i++)
	{
		sum[i] = sum[i-1] + a[i];

	}

	int l=0;
	int h = n-1 ;
	long long t=0 ;
	int mid=0;

	while(l<=h)
	{
		mid = (l+h)/2 ;
		int k = mid+1;
		t = sum[mid] + k*(k+1)/2 * k;

		if(t==S)
		{
			cout << mid+1 << " " << t;
			return 0;
		}
		else if(t < S)
			l = mid+1;
		else
			h = mid-1;

	}

	if(t < S)
		cout << mid+1 << " " << t;
	else
		{
			int k = mid;
			if(k==0)
				cout << 0 << " " << 0;
			else
				cout << mid << " " << sum[mid-1] + k*(k+1)*k/2;
		}

 	return 0;
}


/**
 * code generated by JHelper
 * More info: https://g...content-available-to-author-only...b.com/AlexeyDmitriev/JHelper
 * @author gainullin.ildar
 */

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>

using namespace std;

typedef long long ll;

const int N = 1e5 + 7;

int n, S;
int a[N];
ll b[N];

ll res(int k)
{
    for (int i = 0; i < n; i++)
    {
        b[i] = a[i] + (i + 1) * (ll) k;
    }
    sort(b, b + n);
    ll ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans += b[i];
    }
    return ans;
}

class Main
{
public:
    void solve(std::istream &in, std::ostream &out)
    {
        in >> n >> S;
        for (int i = 0; i < n; i++)
        {
            in >> a[i];
        }
        int l = 0, r = n ;
        while (l < r - 1)
        {
            int m = (l + r) / 2;
            if (res(m) <= S)
            {
                l = m;
            }
            else
            {
                r = m;
            }
        }
        out << l << ' ' << res(l) << '\n';
    }
};

int main()
{
    ios::sync_with_stdio(0);
    Main solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


/**
 * code generated by JHelper
 * More info: https://g...content-available-to-author-only...b.com/AlexeyDmitriev/JHelper
 * @author gainullin.ildar
 */

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>

using namespace std;

typedef long long ll;

const int N = 1e5 + 7;

int n, S;
int a[N];
ll b[N];

ll res(int k)
{
    for (int i = 0; i < n; i++)
    {
        b[i] = a[i] + (i + 1) * (ll) k;
    }
    sort(b, b + n);
    ll ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans += b[i];
    }
    return ans;
}

class Main
{
public:
    void solve(std::istream &in, std::ostream &out)
    {
        in >> n >> S;
        for (int i = 0; i < n; i++)
        {
            in >> a[i];
        }
        int l = 0, r = n + 1;
        while (l < r - 1)
        {
            int m = (l + r) / 2;
            if (res(m) <= S)
            {
                l = m;
            }
            else
            {
                r = m;
            }
        }
        out << l << ' ' << res(l) << '\n';
    }
};

int main()
{
    ios::sync_with_stdio(0);
    Main solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n ;
	long long S;
	cin >> n >> S ;
	vector <long long > sum(n) ;
	vector <int> a(n);

	for(int i=0; i<n; i++)
	{
		cin >> a[i];
	}

	sum[0] = a[0];
	for(int i=1; i<n; i++)
	{
		sum[i] = sum[i-1] + a[i];

	}

	int l=0;
	int h = n-1 ;
	long long t=0 ;
	int mid=0;

	while(l<=h)
	{
		mid = (l+h)/2 ;
		int k = mid+1;
		t = sum[mid] + k*(k+1)/2 * k;

		if(t==S)
		{
			cout << mid+1 << " " << t;
			return 0;
		}
		else if(t < S)
			l = mid+1;
		else
			h = mid-1;

	}

	if(t < S)
		cout << mid+1 << " " << t;
	else
		{
			int k = mid;
			cout << mid << " " << sum[mid-1] + k*(k+1)*k/2;
		}

 	return 0;
}


/**
 * code generated by JHelper
 * More info: https://g...content-available-to-author-only...b.com/AlexeyDmitriev/JHelper
 * @author gainullin.ildar
 */

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>

using namespace std;

typedef long long ll;

const int N = 1e5 + 7;

int n, S;
int a[N];
ll b[N];

ll res(int k)
{
    for (int i = 0; i < n; i++)
    {
        b[i] = a[i] + (i + 1) * (ll) k;
    }
    sort(b, b + n);
    ll ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans += b[i];
    }
    return ans;
}

class Main
{
public:
    void solve(std::istream &in, std::ostream &out)
    {
        in >> n >> S;
        for (int i = 0; i < n; i++)
        {
            in >> a[i];
        }
        int l = 0, r = n + 1;
        while (l < r )
        {
            int m = (l + r) / 2;
            if (res(m) <= S)
            {
                l = m;
            }
            else
            {
                r = m;
            }
        }
        out << l << ' ' << res(l) << '\n';
    }
};

int main()
{
    ios::sync_with_stdio(0);
    Main solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n ;
	long long S;
	cin >> n >> S ;
	vector <long long > sum(n) ;
	vector <int> a(n);

	for(int i=0; i<n; i++)
	{
		cin >> a[i];
	}

	//sort(a.begin(), a.end());

	/*for(int i=0; i<n; i++)
	{
		cout << a[i] << " ";
	}
	*/
	sum[0] = a[0];
	for(int i=1; i<n; i++)
	{
		sum[i] = sum[i-1] + a[i];

	}

	int l=0;
	int h = n-1 ;
	long long t=0 ;
	int mid=0;

	while(l<=h)
	{
		mid = (l+h)/2 ;
		int k = mid+1;
		t = sum[mid] + k*(k+1)/2 * k;

		if(t==S)
		{
			cout << mid+1 << " " << t;
			return 0;
		}
		else if(t < S)
			l = mid+1;
		else
			h = mid-1;

	}

	if(t < S)
		cout << mid+1 << " " << t;
	else
		{
			int k = mid;
			if(k=0)
				cout << 0 << " " << 0;
			else
				cout << mid << " " << sum[mid-1] + k*(k+1)*k/2;
		}

 	return 0;
}


/****** trying to be better *****/
#include<bits/stdc++.h>
#define mem(a,v) memset(a,v,sizeof a)
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define f first
#define s second
#define fr(i,n) for(int j=i;j<n;j++)
#define rev(a) reverse(a.begin(),a.end())
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lb(a,v) lower_bound(all(a),v)
#define ub(a,v) upper_bound(all(a),v)
#define ins(v) insert(v)
#define pb(v) push_back(v)
#define sz(x) (int)(x).size()
#define MOD 1000000007
#define sf1(a) scanf("%d",&a)
#define sfl1(a) scanf("%lld",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sf4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)

#define getbit(x,bit)  x&(1LL<<bit)
#define setbit(x,bit)  x|(1LL<<bit)
#define clearbit(x,bit)  x&(~(1LL<<bit))
#define flipbit(x,bit)  x^(1LL<<bit)

#define IO ios_base::sync_with_stdio(false);
using namespace std;
ll powmod(ll a,ll  b) {if(b==0)return 1;ll cnt=powmod(a,b/2);if(b&1)return cnt*cnt*a;else return cnt*cnt;}
//ll fact(int n){ll ans = 1;for(ll i=1;i<=n;i++)ans = (ans * i)%mod;return ans%mod;}

const int N= 1e5+5,oo=0x3f3f3f3f;
const ll M = 1e12+105;

int dx []={1,-1,0};
int dy []={0,0,1};

ll n,s;
ll c[N];

bool OK(int v){
    ll tot = 0;
    for(int i=0;i<v;i++)
        tot += (c[i]+(i+1*v));
    return tot<=s;
}
pair<int,ll> BS(){
    ll l = 0,mid,r = n;
    while(l<r){
        mid=(l+r+1)/2;
        //cout<<l<<" "<<mid<<" "<<r<<endl;
        if(OK(mid)) l=mid;
        else        r=mid-1;
    }
    ll tot = 0;
    for(int i=0;i<l;i++)
        tot += (c[i]+((i+1)*l));
    if(tot>s){
        l--;
        tot = 0;
        for(int i=0;i<l;i++)
            tot += (c[i]+((i+1)*l));
    }
    return {l,tot};
}
int main() {
	#ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
    scanf("%lld%lld",&n,&s);
    for(int i=0;i<n;i++)scanf("%lld",c+i);
    pair<int, ll >ans = BS();
    printf("%d %lld\n",ans.f,ans.s);
    return 0;
}


/****** trying to be better *****/
#include<bits/stdc++.h>
#define mem(a,v) memset(a,v,sizeof a)
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define f first
#define s second
#define fr(i,n) for(int j=i;j<n;j++)
#define rev(a) reverse(a.begin(),a.end())
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lb(a,v) lower_bound(all(a),v)
#define ub(a,v) upper_bound(all(a),v)
#define ins(v) insert(v)
#define pb(v) push_back(v)
#define sz(x) (int)(x).size()
#define MOD 1000000007
#define sf1(a) scanf("%d",&a)
#define sfl1(a) scanf("%lld",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sf4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)

#define getbit(x,bit)  x&(1LL<<bit)
#define setbit(x,bit)  x|(1LL<<bit)
#define clearbit(x,bit)  x&(~(1LL<<bit))
#define flipbit(x,bit)  x^(1LL<<bit)

#define IO ios_base::sync_with_stdio(false);
using namespace std;
ll powmod(ll a,ll  b) {if(b==0)return 1;ll cnt=powmod(a,b/2);if(b&1)return cnt*cnt*a;else return cnt*cnt;}
//ll fact(int n){ll ans = 1;for(ll i=1;i<=n;i++)ans = (ans * i)%mod;return ans%mod;}

const int N= 1e5+5,oo=0x3f3f3f3f;
const ll M = 1e12+105;

int dx []={1,-1,0};
int dy []={0,0,1};

ll n,s;
ll c[N];
bool OK(int v){
    for(int j=0;j<=n-v;j++){
        ll tot = 0;
        for(int i=j;i<v+j;i++)
            tot += (c[i]+((i+1)*v));
        if(tot<=s)return true;
    }

    return false;
}
pair<int,ll> BS(){
    ll l = 0,mid,r = n;
    while(l<r){
        mid=(l+r+1)/2;
        //cout<<l<<" "<<mid<<" "<<r<< endl;
        if(OK(mid)) l=mid;
        else        r=mid-1;
    }
    ll tot = 0;
    for(int i=0;i<l;i++)
        tot += (c[i]+((i+1)*l));
    /*if(tot>s){
        l--;
        tot = 0;
        for(int i=0;i<l;i++)
            tot += (c[i]+((i+1)*l));
    }*/
    return {l,tot};
}
int main() {
	#ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
    scanf("%lld%lld",&n,&s);
    for(int i=0;i<n;i++)scanf("%lld",c+i);
    pair<int, ll >ans = BS();
    printf("%d %lld\n",ans.f,ans.s);
    return 0;
}


/****** trying to be better *****/
#include<bits/stdc++.h>
#define mem(a,v) memset(a,v,sizeof a)
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define f first
#define s second
#define fr(i,n) for(int j=i;j<n;j++)
#define rev(a) reverse(a.begin(),a.end())
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lb(a,v) lower_bound(all(a),v)
#define ub(a,v) upper_bound(all(a),v)
#define ins(v) insert(v)
#define pb(v) push_back(v)
#define sz(x) (int)(x).size()
#define MOD 1000000007
#define sf1(a) scanf("%d",&a)
#define sfl1(a) scanf("%lld",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sf4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)

#define getbit(x,bit)  x&(1LL<<bit)
#define setbit(x,bit)  x|(1LL<<bit)
#define clearbit(x,bit)  x&(~(1LL<<bit))
#define flipbit(x,bit)  x^(1LL<<bit)

#define IO ios_base::sync_with_stdio(false);
using namespace std;
ll powmod(ll a,ll  b) {if(b==0)return 1;ll cnt=powmod(a,b/2);if(b&1)return cnt*cnt*a;else return cnt*cnt;}
//ll fact(int n){ll ans = 1;for(ll i=1;i<=n;i++)ans = (ans * i)%mod;return ans%mod;}

const int N= 1e5+5,oo=0x3f3f3f3f;
const ll M = 1e12+105;

int dx []={1,-1,0};
int dy []={0,0,1};

ll n,s;
ll c[N];

bool OK(int v){
    ll tot = 0;
    for(int j=0;j<n-v;j++)
        for(int i=j;i<v+j;i++)
            tot += (c[i]+(i+1*v));
    return tot<=s;
}
pair<int,ll> BS(){
    ll l = 0,mid,r = n;
    while(l<r){
        mid=(l+r+1)/2;
        //cout<<l<<" "<<mid<<" "<<r<<endl;
        if(OK(mid)) l=mid;
        else        r=mid-1;
    }
    ll tot = 0;
    for(int i=0;i<l;i++)
        tot += (c[i]+((i+1)*l));
    if(tot>s){
        l--;
        tot = 0;
        for(int i=0;i<l;i++)
            tot += (c[i]+((i+1)*l));
    }
    return {l,tot};
}
int main() {
	#ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
    scanf("%lld%lld",&n,&s);
    for(int i=0;i<n;i++)scanf("%lld",c+i);
    pair<int, ll >ans = BS();
    printf("%d %lld\n",ans.f,ans.s);
    return 0;
}


/****** trying to be better *****/
#include<bits/stdc++.h>
#define mem(a,v) memset(a,v,sizeof a)
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define f first
#define s second
#define fr(i,n) for(int j=i;j<n;j++)
#define rev(a) reverse(a.begin(),a.end())
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lb(a,v) lower_bound(all(a),v)
#define ub(a,v) upper_bound(all(a),v)
#define ins(v) insert(v)
#define pb(v) push_back(v)
#define sz(x) (int)(x).size()
#define MOD 1000000007
#define sf1(a) scanf("%d",&a)
#define sfl1(a) scanf("%lld",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sf4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)

#define getbit(x,bit)  x&(1LL<<bit)
#define setbit(x,bit)  x|(1LL<<bit)
#define clearbit(x,bit)  x&(~(1LL<<bit))
#define flipbit(x,bit)  x^(1LL<<bit)

#define IO ios_base::sync_with_stdio(false);
using namespace std;
ll powmod(ll a,ll  b) {if(b==0)return 1;ll cnt=powmod(a,b/2);if(b&1)return cnt*cnt*a;else return cnt*cnt;}
//ll fact(int n){ll ans = 1;for(ll i=1;i<=n;i++)ans = (ans * i)%mod;return ans%mod;}

const int N= 1e5+5,oo=0x3f3f3f3f;
const ll M = 1e12+105;

int dx []={1,-1,0};
int dy []={0,0,1};

ll n,s;
ll c[N];

bool OK(int v){
    ll tot = 0;
    for(int i=0;i<v;i++)
        tot += (c[i]+(i+1*v));
    return tot<=s;
}
pair<int,ll> BS(){
    ll l = 0,mid,r = n;
    while(l<r){
        mid=(l+r+1)/2;
        //cout<<l<<" "<<mid<<" "<<r<<endl;
        if(OK(mid)) l=mid;
        else        r=mid-1;
    }
    ll tot = 0;
    for(int i=0;i<l;i++)
        tot += (c[i]+((i+1)*l));
    return {l,tot};
}
int main() {
	#ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
    scanf("%lld%lld",&n,&s);
    for(int i=0;i<n;i++)scanf("%lld",c+i);
    pair<int, ll >ans = BS();
    printf("%d %lld\n",ans.f,ans.s);
    return 0;
}


/****** trying to be better *****/
#include<bits/stdc++.h>
#define mem(a,v) memset(a,v,sizeof a)
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define f first
#define s second
#define fr(i,n) for(int j=i;j<n;j++)
#define rev(a) reverse(a.begin(),a.end())
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lb(a,v) lower_bound(all(a),v)
#define ub(a,v) upper_bound(all(a),v)
#define ins(v) insert(v)
#define pb(v) push_back(v)
#define sz(x) (int)(x).size()
#define MOD 1000000007
#define sf1(a) scanf("%d",&a)
#define sfl1(a) scanf("%lld",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sf4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)

#define getbit(x,bit)  x&(1LL<<bit)
#define setbit(x,bit)  x|(1LL<<bit)
#define clearbit(x,bit)  x&(~(1LL<<bit))
#define flipbit(x,bit)  x^(1LL<<bit)

#define IO ios_base::sync_with_stdio(false);
using namespace std;
ll powmod(ll a,ll  b) {if(b==0)return 1;ll cnt=powmod(a,b/2);if(b&1)return cnt*cnt*a;else return cnt*cnt;}
//ll fact(int n){ll ans = 1;for(ll i=1;i<=n;i++)ans = (ans * i)%mod;return ans%mod;}

const int N= 1e5+5,oo=0x3f3f3f3f;
const ll M = 1e12+105;

int dx []={1,-1,0};
int dy []={0,0,1};

ll n,s;
ll c[N];
ll tmp[N];
bool OK(ll v){
    ll tot= 0;
    for(int i=0;i<n;i++) tmp[i]=(c[i]+((i+1)*v));
    sort(tmp,tmp+n);
    for(int i=0;i<v;i++)    tot += tmp[i];
    return tot<=s;
}
pair<int,ll> BS(){
    ll l = 0,mid,r = n;
    while(l<r){
        mid=(l+r+1)/2;
        if(OK(mid)) l=mid;
        else        r=mid-1;
    }
    ll tot = 0;
    for(int i=0;i<n;i++) tmp[i]=(c[i]+((i+1)*l));
    sort(tmp,tmp+n);
    for(int i=0;i<l;i++)    tot += tmp[i];
    return {l,tot};
}
int main() {
	#ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
    scanf("%lld%lld",&n,&s);
    for(int i=0;i<n;i++)scanf("%lld",c+i);
    pair<int, ll >ans = BS();
    printf("%d %lld\n",ans.f,ans.s);
    return 0;
}


/****** trying to be better *****/
#include<bits/stdc++.h>
#define mem(a,v) memset(a,v,sizeof a)
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define f first
#define s second
#define fr(i,n) for(int j=i;j<n;j++)
#define rev(a) reverse(a.begin(),a.end())
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lb(a,v) lower_bound(all(a),v)
#define ub(a,v) upper_bound(all(a),v)
#define ins(v) insert(v)
#define pb(v) push_back(v)
#define sz(x) (int)(x).size()
#define MOD 1000000007
#define sf1(a) scanf("%d",&a)
#define sfl1(a) scanf("%lld",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sf4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)

#define getbit(x,bit)  x&(1LL<<bit)
#define setbit(x,bit)  x|(1LL<<bit)
#define clearbit(x,bit)  x&(~(1LL<<bit))
#define flipbit(x,bit)  x^(1LL<<bit)

#define IO ios_base::sync_with_stdio(false);
using namespace std;
ll powmod(ll a,ll  b) {if(b==0)return 1;ll cnt=powmod(a,b/2);if(b&1)return cnt*cnt*a;else return cnt*cnt;}
//ll fact(int n){ll ans = 1;for(ll i=1;i<=n;i++)ans = (ans * i)%mod;return ans%mod;}

const int N= 1e5+5,oo=0x3f3f3f3f;
const ll M = 1e12+105;

int dx []={1,-1,0};
int dy []={0,0,1};

ll n,s;
ll c[N];
bool OK(ll v){
    for(int j=0;j<=n-v;j++){
        ll tot = 0,cc=1;
        for(int i=j;i<v+j;i++)
            tot += (c[i]+(cc*v)),cc++;
        //cout<<tot<<endl;
        if(tot<=s)return true;
    }

    return false;
}
pair<int,ll> BS(){
    ll l = 0,mid,r = n;
    while(l<r){
        mid=(l+r+1)/2;
        //cout<<l<<" "<<mid<<" "<<r<< endl;
        if(OK(mid)) l=mid;
        else        r=mid-1;
    }
    ll mn = 1e18+5;
    for(int j=0;j<=n-l;j++){
        ll tot = 0,cc=1;
        for(int i=j;i<l+j;i++)
            tot += (c[i]+(cc*l)),cc++;
        mn = min(mn,tot);
    }
    return {l,mn};
}
int main() {
	#ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
    scanf("%lld%lld",&n,&s);
    for(int i=0;i<n;i++)scanf("%lld",c+i);
    pair<int, ll >ans = BS();
    printf("%d %lld\n",ans.f,ans.s);
    return 0;
}


/****** trying to be better *****/
#include<bits/stdc++.h>
#define mem(a,v) memset(a,v,sizeof a)
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define f first
#define s second
#define fr(i,n) for(int j=i;j<n;j++)
#define rev(a) reverse(a.begin(),a.end())
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lb(a,v) lower_bound(all(a),v)
#define ub(a,v) upper_bound(all(a),v)
#define ins(v) insert(v)
#define pb(v) push_back(v)
#define sz(x) (int)(x).size()
#define MOD 1000000007
#define sf1(a) scanf("%d",&a)
#define sfl1(a) scanf("%lld",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sf4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)

#define getbit(x,bit)  x&(1LL<<bit)
#define setbit(x,bit)  x|(1LL<<bit)
#define clearbit(x,bit)  x&(~(1LL<<bit))
#define flipbit(x,bit)  x^(1LL<<bit)

#define IO ios_base::sync_with_stdio(false);
using namespace std;
ll powmod(ll a,ll  b) {if(b==0)return 1;ll cnt=powmod(a,b/2);if(b&1)return cnt*cnt*a;else return cnt*cnt;}
//ll fact(int n){ll ans = 1;for(ll i=1;i<=n;i++)ans = (ans * i)%mod;return ans%mod;}

const int N= 1e5+5,oo=0x3f3f3f3f;
const ll M = 1e12+105;

int dx []={1,-1,0};
int dy []={0,0,1};

ll n,s;
ll c[N];

bool OK(int v){
    ll tot = 0;
    for(int j=0;j<n-v;j++)
        for(int i=j;i<v+j;i++)
            tot += (c[i]+((i+1)*v));
    return tot<=s;
}
pair<int,ll> BS(){
    ll l = 0,mid,r = n;
    while(l<r){
        mid=(l+r+1)/2;
        //cout<<l<<" "<<mid<<" "<<r<<endl;
        if(OK(mid)) l=mid;
        else        r=mid-1;
    }
    ll tot = 0;
    for(int i=0;i<l;i++)
        tot += (c[i]+((i+1)*l));
    if(tot>s){
        l--;
        tot = 0;
        for(int i=0;i<l;i++)
            tot += (c[i]+((i+1)*l));
    }
    return {l,tot};
}
int main() {
	#ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
    scanf("%lld%lld",&n,&s);
    for(int i=0;i<n;i++)scanf("%lld",c+i);
    pair<int, ll >ans = BS();
    printf("%d %lld\n",ans.f,ans.s);
    return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
int n, s,current_taken = 0, current_paid = 0;
vector<long long>bases, temp;
long long total(int k) {
	long long answer = 0;
	for (int i = 0; i < n; ++i) {
		temp[i] = bases[i] + (i + 1) * (long long)k;
	}
	for (int i = 0; i < k; ++i) {
		answer += temp[i];
	}
	return answer;
}

int main()
{
	cin >> n;
	bases.resize(n);
	temp.resize(n);
	cin >> s;
	for (int i = 0; i < n; ++i) {
		cin >> bases[i];
	}
	sort(bases.begin(), bases.end());
	int low = 0, high = n +1;
	while (low < high - 1 ) {
		int mid = low + (high - low) / 2;
		total(mid) <= s ? low = mid : high = mid;
	}
	cout << low << " " << total(low) << '\n';
}


#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
int n, s;
vector<long long>bases, temp;
long long total(int k) {
	long long answer = 0;
	for (int i = 0; i < n; ++i) {
		temp[i] = bases[i] + (i + 1) * (long long)k;
	}
	sort(temp.begin(), temp.end());
	for (int i = 0; i < k; ++i) {
		answer += temp[i];
	}
	return answer;
}

int main()
{
	cin >> n;
	bases.resize(n);
	temp.resize(n);
	cin >> s;
	for (int i = 0; i < n; ++i) {
		cin >> bases[i];
	}
	int low = 0, high = n +1;
	while (low < high - 1 ) {
		int mid = (low + high) / 2;
		total(mid) <= s ? low = mid : high = mid;
	}
	cout << low << " " << total(low) << '\n';
}


#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
int n, s,current_taken = 0, current_paid = 0;
vector<long long>bases, temp;
long long total(int k) {
	long long answer = 0;
	for (int i = 0; i < n; ++i) {
		temp[i] = bases[i] + (i + 1) * (long long)k;
	}
	for (int i = 0; i < k; ++i) {
		answer += temp[i];
	}
	return answer;
}

int main()
{
	cin >> n;
	bases.resize(n);
	temp.resize(n);
	cin >> s;
	for (int i = 0; i < n; ++i) {
		cin >> bases[i];
	}
	sort(bases.begin(), bases.end());
	int low = 0, high = n +1;
	while (low < high - 1 ) {
		int mid = (low + high) / 2;
		total(mid) <= s ? low = mid : high = mid;
	}
	cout << low << " " << total(low) << '\n';
}


#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
int n, s;
vector<long long>bases, temp;
long long total(int k) {
	long long answer = 0;
	for (int i = 0; i < n; ++i) {
		temp[i] = bases[i] + (i + 1) * (long long)k;
	}
	sort(temp.begin(), temp.end());
	for (int i = 0; i < k; ++i) {
		answer += temp[i];
	}
	return answer;
}

int main()
{
	cin >> n;
	bases.resize(n);
	temp.resize(n);
	cin >> s;
	for (int i = 0; i < n; ++i) {
		cin >> bases[i];
	}
	sort(bases.begin(), bases.end());
	int low = 0, high = n +1;
	while (low < high - 1 ) {
		int mid = (low + high) / 2;
		total(mid) <= s ? low = mid : high = mid;
	}
	cout << low << " " << total(low) << '\n';
}


#include<iostream>
using namespace std;
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<stack>
#include<utility>
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
#define fr(i ,n)  for (int i = 0; i < n; i++)
#define pb(x)  pushback(x)
#define fr(i,n)   for (int i = 0; i < n; i++)
typedef long long ll;
#define adjList  vector<vector<int> >

int n, s;
vector<int> a;

bool can(int numSov , int &TotSum)
{
	ll sum = 0;
	for (int i = 0; i < numSov; i++)
	{
		sum += a[i] + (i+1) * numSov;
		if (sum > s)
			return false;
	}
	TotSum = sum;
	return true;
}

int main()
{
	cin >> n >> s;
	a.resize(n);
	fr(i, n)
		cin >> a[i];
	int l = 0, r =n ,mid,
		ans=0,totSum=0;
	while (l<=r)
	{
		mid = l + (r - l) / 2;
		if (can(mid,totSum))
		{
			ans = mid;
			l = mid + 1;
		}
		else
			r = mid - 1;
	}
	cout << ans<<" "<<totSum;
	return 0;
}


#include<iostream>
using namespace std;
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<stack>
#include<utility>
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
#define fr(i ,n)  for (int i = 0; i < n; i++)
#define pb(x)  pushback(x)
#define fr(i,n)   for (int i = 0; i < n; i++)
typedef long long ll;
#define adjList  vector<vector<int> >

int n, s;
vector<int> a;

bool can(int numSov)
{
	ll sum = 0;
	for (int i = 0; i < numSov; i++)
	{
		sum += a[i] + (i+1) * numSov;
		if (sum > s)
			return false;
	}
	return true;
}

int main()
{
	cin >> n >> s;
	a.resize(n);
	fr(i, n)
		cin >> a[i];
	sort(a.begin(), a.end());
	int l = 0, r =n ,mid,ans=0;
	while (l<=r)
	{
		mid = l + (r - l) / 2;
		if (can(mid))
		{
			ans = mid;
			l = mid + 1;
		}
		else
			r = mid - 1;
	}
	cout << ans;
	return 0;
}


#include<iostream>
using namespace std;
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<stack>
#include<utility>
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
#define fr(i ,n)  for (int i = 0; i < n; i++)
#define pb(x)  pushback(x)
#define fr(i,n)   for (int i = 0; i < n; i++)
typedef long long ll;
#define adjList  vector<vector<int> >

int n, s;
vector<int> a;

bool can(int numSov , int &TotSum)
{
	ll sum = 0;
	for (int i = 0; i < numSov; i++)
	{
		sum += a[i] + (i+1) * numSov;
		if (sum > s)
			return false;
	}
	TotSum = sum;
	return true;
}

int main()
{
	cin >> n >> s;
	a.resize(n);
	fr(i, n)
		cin >> a[i];
	sort(a.rbegin(), a.rend());
	int l = 0, r =n ,mid,
		ans=0,totSum=0;
	while (l<=r)
	{
		mid = l + (r - l) / 2;
		if (can(mid,totSum))
		{
			ans = mid;
			l = mid + 1;
		}
		else
			r = mid - 1;
	}
	cout << ans<<" "<<totSum;
	return 0;
}


#include<iostream>
using namespace std;
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<stack>
#include<utility>
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
#define fr(i ,n)  for (int i = 0; i < n; i++)
#define pb(x)  pushback(x)
#define fr(i,n)   for (ll i = 0; i < n; i++)
typedef long long ll;
#define adjList  vector<vector<int> >

ll n, s;
vector<ll> a, temp;

bool can(ll numSov, ll & TotSum)
{
	fr(i, n)
		temp[i] = a[i] + ((i + 1) * numSov);

	sort(temp.begin(), temp.end());
	ll sum = 0;
	for (int i = 0; i < numSov; i++)
		sum += temp[i];
	if (sum > s)
		return false;
	else
	{
		TotSum = sum;
		return true;
	}
}

int main()
{
	cin >> n >> s;
	a.resize(n);
	temp.resize(n);
	fr(i, n)
		cin >> a[i];

	ll l = 0, r = n, mid, ans = 0;
	ll totSum=0;
	while (l<=r)
	{
		mid = l + (r - l) / 2;
		if (can(mid,totSum))
		{
			ans = mid;
			l = mid + 1;
		}
		else
			r = mid - 1;
	}
	cout << ans<<" "<<totSum;
	return 0;
}


#include<iostream>
using namespace std;
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<stack>
#include<utility>
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
#define fr(i ,n)  for (int i = 0; i < n; i++)
#define pb(x)  pushback(x)
#define fr(i,n)   for (int i = 0; i < n; i++)
typedef long long ll;
#define adjList  vector<vector<int> >

int n, s;
vector<int> a;

bool can(int numSov , int &TotSum)
{
	ll sum = 0;
	for (int i = 0; i < numSov; i++)
	{
		sum += a[i] + (i+1) * numSov;
		if (sum > s)
			return false;
	}
	TotSum = sum;
	return true;
}

int main()
{
	cin >> n >> s;
	a.resize(n);
	fr(i, n)
		cin >> a[i];
	sort(a.begin(), a.end());
	int l = 0, r =n ,mid,
		ans=0,totSum=0;
	while (l<=r)
	{
		mid = l + (r - l) / 2;
		if (can(mid,totSum))
		{
			ans = mid;
			l = mid + 1;
		}
		else
			r = mid - 1;
	}
	cout << ans<<" "<<totSum;
	return 0;
}


#include<iostream>
using namespace std;
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<stack>
#include<utility>
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
#define fr(i ,n)  for (int i = 0; i < n; i++)
#define pb(x)  pushback(x)
#define fr(i,n)   for (int i = 0; i < n; i++)
typedef long long ll;
#define adjList  vector<vector<int> >

int n, s;
vector<int> a, temp;

bool can(int numSov, ll & TotSum)
{
	fr(i, n)
		temp[i] = a[i] + (i + 1) * numSov;
	sort(temp.begin(), temp.end());

	ll sum = 0;
	for (int i = 0; i < numSov; i++)
		sum += temp[i];
	if (sum > s)
		return false;
	else
	{
		TotSum = sum;
		return true;
	}
}

int main()
{
	cin >> n >> s;
	a.resize(n);
	temp.resize(n);
	fr(i, n)
		cin >> a[i];

	int l = 0, r = n, mid, ans = 0;
	ll totSum=0;
	while (l<=r)
	{
		mid = l + (r - l) / 2;
		if (can(mid,totSum))
		{
			ans = mid;
			l = mid + 1;
		}
		else
			r = mid - 1;
	}
	cout << ans<<" "<<totSum;
	return 0;
}


#include<iostream>
using namespace std;
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<stack>
#include<utility>
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
#define fr(i ,n)  for (int i = 0; i < n; i++)
#define pb(x)  pushback(x)
#define fr(i,n)   for (int i = 0; i < n; i++)
typedef long long ll;
#define adjList  vector<vector<int> >

int n, s;
vector<ll> a, temp;

bool can(int numSov, ll & TotSum)
{
	fr(i, n)
		temp[i] = a[i] + (i + 1) * numSov;

	sort(temp.begin(), temp.end());
	ll sum = 0;
	for (int i = 0; i < numSov; i++)
		sum += temp[i];
	if (sum > s)
		return false;
	else
	{
		TotSum = sum;
		return true;
	}
}

int main()
{
	cin >> n >> s;
	a.resize(n);
	temp.resize(n);
	fr(i, n)
		cin >> a[i];

	int l = 0, r = n, mid, ans = 0;
	ll totSum=0;
	while (l<=r)
	{
		mid = l + (r - l) / 2;
		if (can(mid,totSum))
		{
			ans = mid;
			l = mid + 1;
		}
		else
			r = mid - 1;
	}
	cout << ans<<" "<<totSum;
	return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
inline int mmin(int a, int b) { return (a > b) ? b : a; }
inline int mmax(int a, int b) { return (a > b) ? a : b; }
int k, n, t;
long long s;
vector<int> prices;
long long check(int test_k) {
	vector<long long> nums(n);
	for (int i = 0; i < prices.size(); i++) {
		long long price = prices[i] + (i + 1) * test_k;
		nums[i] = price;
	}
	sort(nums.begin(), nums.end());
	long long ans = 0;
	for (int i = 0; i < test_k; i++) {
	    ans += nums[i];
	}
	return ans;
}

int binary_search(int low, int high) {
	if (low == high) return low;
	if (low + 1 == high) {
		if (check(high) <= s) { return high; }
		return low;
	}
	int mid = (low + high) / 2;
	if (check(mid) >= s) { return binary_search(low, mid); }
	else return binary_search(mid + 1, high);
}

int main() {
	cin >> n >> s;
	//vector<int> prices(n);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		prices.push_back(x);
	}
	k = binary_search(0, n);
	cout << k << endl << check(k) << endl;
	//cout << check(3)<<endl;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <utility>
#include <set>
using namespace std;
inline int mmin(int a, int b) { return (a > b) ? b : a; }
inline int mmax(int a, int b) { return (a > b) ? a : b; }
int k, n, s, t;
vector<int> prices;
int check(int test_k) {
	multiset<int> nums;
	for (int i = 0; i < prices.size(); i++) {
		int price = prices[i] + (i + 1) * test_k;
		if (nums.size() < test_k) {
			nums.insert(price);
		}
		else {
			if (price < *nums.rbegin()) {
				nums.insert(price);
				nums.erase(*nums.rbegin());
			}
		}
	}
	int ans = 0;
	for (int a : nums) {
	    //cout << a << endl;
		ans += a;
	}
	return ans;
}

int binary_search(int low, int high) {
	if (low == high) return low;
	if (low + 1 == high) {
		if (check(high) <= s) { return high; }
		return low;
	}
	int mid = (low + high) / 2;
	if (check(mid) >= s) { return binary_search(low, mid); }
	else return binary_search(mid + 1, high);
}

int main() {
	cin >> n >> s;
	//vector<int> prices(n);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		prices.push_back(x);
	}
	k = binary_search(0, n);
	cout << k << endl << check(k) << endl;
	//cout << check(3)<<endl;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <fstream>
using namespace std;
inline int mmin(int a, int b) { return (a > b) ? b : a; }
inline int mmax(int a, int b) { return (a > b) ? a : b; }
int k, n, t;
long long s;
vector<int> prices;
long long check(int test_k) {
    if (test_k == 0) return 0;
	vector<long long> nums(n);
	for (int i = 0; i < prices.size(); i++) {
		if ((i + 1) > (s / test_k)) {
			nums[i] = s + 1;
		}
		else {
			long long price = prices[i] + (i + 1) * test_k;
			nums[i] = price;
		}
	}
	sort(nums.begin(), nums.end());
	long long ans = 0;
	for (int i = 0; i < test_k; i++) {
		ans += nums[i];
		if (ans > s) {
			return s + 1;
		}
	}
	return ans;
}

int binary_search(int low, int high) {
	if (low == high) return low;
	if (low + 1 == high) {
		if (check(high) <= s) { return high; }
		return low;
	}
	int mid = (low + high) / 2;
	if (check(mid) >= s) { return binary_search(low, mid); }
	else return binary_search(mid, high);
}

int main() {
	//ifstream fin("tc.out");
	cin >> n >> s;
	//vector<int> prices(n);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		prices.push_back(x);
	}
	k = binary_search(0, n);
	//cout << check(50000) << endl;
	//cout << (check(50000) >= s) << endl;
	//cout << check(1206) << (check(1206) > s) << endl;
	//cout << check(1207) << (check(1207) > s) << endl;
	cout << k << endl << check(k) << endl;
	//cout << check(3)<<endl;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <fstream>
using namespace std;
inline int mmin(int a, int b) { return (a > b) ? b : a; }
inline int mmax(int a, int b) { return (a > b) ? a : b; }
int k, n, t;
long long s;
vector<int> prices;
long long check(int test_k) {
	vector<long long> nums(n);
	for (int i = 0; i < prices.size(); i++) {
		if ((i + 1) > (s / test_k)) {
			nums[i] = s + 1;
		}
		else {
			long long price = prices[i] + (i + 1) * test_k;
			nums[i] = price;
		}
	}
	sort(nums.begin(), nums.end());
	long long ans = 0;
	for (int i = 0; i < test_k; i++) {
		ans += nums[i];
		if (ans > s) {
			return s + 1;
		}
	}
	return ans;
}

int binary_search(int low, int high) {
	if (low == high) return low;
	if (low + 1 == high) {
		if (check(high) <= s) { return high; }
		return low;
	}
	int mid = (low + high) / 2;
	if (check(mid) >= s) { return binary_search(low, mid); }
	else return binary_search(mid, high);
}

int main() {
	//ifstream fin("tc.out");
	cin >> n >> s;
	//vector<int> prices(n);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		prices.push_back(x);
	}
	k = binary_search(0, n);
	//cout << check(50000) << endl;
	//cout << (check(50000) >= s) << endl;
	//cout << check(1206) << (check(1206) > s) << endl;
	//cout << check(1207) << (check(1207) > s) << endl;
	cout << k << endl << check(k) << endl;
	//cout << check(3)<<endl;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <utility>
#include <set>
using namespace std;
inline int mmin(int a, int b) { return (a > b) ? b : a; }
inline int mmax(int a, int b) { return (a > b) ? a : b; }
int k, n, t;
long long s;
vector<int> prices;
long long check(int test_k) {
	multiset<int> nums;
	for (int i = 0; i < prices.size(); i++) {
		int price = prices[i] + (i + 1) * test_k;
		if (nums.size() < test_k) {
			nums.insert(price);
		}
		else {
			if (price < *nums.rbegin()) {
				nums.insert(price);
				nums.erase(*nums.rbegin());
			}
		}
	}
	long long ans = 0;
	for (int a : nums) {
	    //cout << a << endl;
		ans += a;
	}
	return ans;
}

int binary_search(int low, int high) {
	if (low == high) return low;
	if (low + 1 == high) {
		if (check(high) <= s) { return high; }
		return low;
	}
	int mid = (low + high) / 2;
	if (check(mid) >= s) { return binary_search(low, mid); }
	else return binary_search(mid + 1, high);
}

int main() {
	cin >> n >> s;
	//vector<int> prices(n);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		prices.push_back(x);
	}
	k = binary_search(0, n);
	cout << k << endl << check(k) << endl;
	//cout << check(3)<<endl;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <utility>
#include <set>
using namespace std;
inline int mmin(int a, int b) { return (a > b) ? b : a; }
inline int mmax(int a, int b) { return (a > b) ? a : b; }
int k, n, t;
long long s;
vector<int> prices;
long long check(int test_k) {
	multiset<long long> nums;
	for (int i = 0; i < prices.size(); i++) {
		long long price = prices[i] + (i + 1) * test_k;
		if (nums.size() < test_k) {
			nums.insert(price);
		}
		else {
			if (price < *nums.rbegin()) {
				nums.insert(price);
				nums.erase(*nums.rbegin());
			}
		}
	}
	long long ans = 0;
	for (long long a : nums) {
	    //cout << a << endl;
		ans += a;
	}
	return ans;
}

int binary_search(int low, int high) {
	if (low == high) return low;
	if (low + 1 == high) {
		if (check(high) <= s) { return high; }
		return low;
	}
	int mid = (low + high) / 2;
	if (check(mid) >= s) { return binary_search(low, mid); }
	else return binary_search(mid + 1, high);
}

int main() {
	cin >> n >> s;
	//vector<int> prices(n);
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		prices.push_back(x);
	}
	k = binary_search(0, n);
	cout << k << endl << check(k) << endl;
	//cout << check(3)<<endl;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iterator>

using namespace std;

long long price (vector<long long> v, long long k)
{
	for (long long i = 0; i < v.size(); ++i)
		v[i] = v[i] + (i + 1) * k;

	sort (v.begin(), v.end());

	return accumulate (v.begin(), v.begin() + k, 0);
}

long long get_result (vector<long long> &v, long long s)
{
	long long l = 0, r = v.size() + 1;

	while (l < r - 1)
	{
		long long m = l + (r - l) / 2;

		if (price (v, m) <= s)
			l = m;
		else
			r = m;
	}

	return l;
}

int main()
{
	long long n, s;
	cin >> n >> s;

	vector<long long> v;
	copy (istream_iterator<long long>(cin), istream_iterator<long long>(), back_inserter (v));

	long long res = get_result (v, s);
	cout << res << " " << price (v, res) << endl;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iterator>

using namespace std;

long long price (vector<long long> v, int k)
{
	for (int i = 0; i < v.size(); ++i)
		v[i] = v[i] + (i + 1) * k;

	sort (v.begin(), v.end());

	return accumulate (v.begin(), v.begin() + k, 0);
}

int get_result (vector<long long> &v, int s)
{
	int l = 0, r = v.size() + 1;

	while (l < r - 1)
	{
		int m = l + (r - l) / 2;

		if (price (v, m) <= s)
			l = m;
		else
			r = m;
	}

	return l;
}

int main()
{
	int n, s;
	cin >> n >> s;

	vector<long long> v;
	copy (istream_iterator<long long>(cin), istream_iterator<long long>(), back_inserter (v));

	int res = get_result (v, s);
	cout << res << " " << price (v, res) << endl;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <utility>

using namespace std;

bool is_can_buy (vector<long long> v, long long k, long long s, long long &res)
{
	for (long long i = 0; i < v.size(); ++i)
		v[i] = v[i] + (i + 1) * k;

	sort (v.begin(), v.end());

	int sum = 0;

	for (int i = 0; i < k && sum <= s; ++i)
		sum += v[i];

	if (sum <= s)
		res = sum;

	return sum <= s;
}

pair<long long, long long> get_result (vector<long long> &v, long long s)
{
	long long l = 0, r = v.size() + 1, res = 0;

	while (l < r - 1)
	{
		long long m = l + (r - l) / 2;

		if (is_can_buy (v, m, s, res))
			l = m;
		else
			r = m;
	}

	return make_pair (l, res);
}

int main()
{
	long long n, s;
	cin >> n >> s;

	vector<long long> v;
	copy (istream_iterator<long long>(cin), istream_iterator<long long>(), back_inserter (v));

	pair <long long, long long> res = get_result (v, s);
	cout << res.first << " " << res.second << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <stack>
#include <utility>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>

#define print(i) cout << i << '\n'
#define pb push_back
#define eb emplace_back
#define INF 1000000000
#define mp make_pair

typedef long long llong;
typedef unsigned int uint;

using namespace std;

const int MAXN = (int)1e9 + 2;
const llong MOD = (llong)1e7 + 9;
const int P = 11;

int binpow(int a, int b) {
	if (b == 0) {
		return 1;
	}
	if (b % 2 == 0) {
		int d = binpow(a, b / 2);
		return d * d;
	}
	else {
		return binpow(a, b - 1) * a;
	}
}

vector<int> souvenirs;
llong n, k;

bool amount(llong t, pair<llong, llong>& ans) {
	vector<llong> costs(souvenirs.size());
	for (int i = 0; i < souvenirs.size(); i++) {
		costs[i] = souvenirs[i] + ((i + 1) * t);
	}
	/*
	cout << "COSTS are: \n";
	for (int c : costs) {
		cout << c << ' ';
	}
	cout << '\n';
	*/
	llong i = 0;
	llong cost = 0;
	sort(costs.begin(), costs.end());
	for (i; i < min(t, (llong)souvenirs.size()); i++) {
		cost += costs[i];

	}
	ans = mp(i, cost);
	return cost <= k;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin >> n >> k;
	souvenirs.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> souvenirs[i];
	}
	llong left = 0;
	llong right = n + 1;
	llong mid;
	llong mx = 0;
	llong ans = 0;
	while (right - left > 1) {
		mid = (right + left) / 2;
		pair<llong, llong> pans;
		bool ok = amount(mid, pans);
		llong am = pans.first;
		llong cost = pans.second;
		// cout << "MID " << mid << "\nAM - " << am << "\nCOST - " << cost << "\nOK - " << ok <<  '\n';
		if (ok) {
			mx = am;
			ans = cost;
			left = mid;
		}
		else {
			right = mid;
		}
	}
	cout << mx << ' ' << ans;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long int;

int n;
vector <int> a;
vector <ll> b;

int check(int x) {
	for (int i = 0; i < n; i++)
		b[i] = a[i] + (i+1) * x;

	sort(b.begin(), b.end());

	ll sum = 0;

	for (int i = 0; i < x; i++)
		sum += b[i];

	return sum;
}

int b_search(int k) {
	int l = 0, r = n;
	while (l <= r) {
		int x = (r + l) / 2;
		if (check(x) <= k && (x + 1 > n || check(x+1) > k))
			return x;
		else {
			if (check(x) < k)
				l = x + 1;
			else
				r = x - 1;
		}
	}
	return -1;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int q = 1;
#ifdef _DEBUG
	q = 1;
#endif
	while (q--) {
		int k;
		cin >> n >> k;
		a.resize(n);
		b.resize(n);

		for (int i = 0; i < n; i++)
			cin >> a[i];

		cout << (k = b_search(k)) << " ";
		if (k != -1) cout << check(k);
		else cout << 0;
		cout << "\n";
	}
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long int;

int n;
vector <int> a;
vector <ll> b;

ll check(int x) {
	for (int i = 0; i < n; i++)
		b[i] = a[i] + (ll)(i + 1) * x;

	sort(b.begin(), b.end());

	ll sum = 0;

	for (int i = 0; i < x; i++)
		sum += b[i];

	return sum;
}

int b_search(int k) {
	int l = 0, r = n;
	while (l <= r) {
		int x = (r + l) / 2;
		ll c;
		if ((c = check(x)) <= k && (x + 1 > n || check(x + 1) > k))
			return x;
		else {
			if (c < k)
				l = x + 1;
			else
				r = x - 1;
		}
	}
	return -1;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int q = 1;
#ifdef _DEBUG
	q = 1;
#endif
	while (q--) {
		int k;
		cin >> n >> k;
		a.resize(n);
		b.resize(n);

		for (int i = 0; i < n; i++)
			cin >> a[i];

		cout << (k = b_search(k)) << " ";
		if (k != -1) cout << check(k);
		else cout << 0;
		cout << "\n";
	}
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n;
vector <int> a;

int check(int x) {
	return ((1 + x) * x / 2 * x) + a[x-1];
}

int b_search(int k) {
	int l = 1, r = n;
	while (l <= r) {
		int x = (r + l) / 2;
		if (check(x) <= k && (x + 1 > n || check(x+1) > k))
			return x;
		else {
			if (check(x) < k)
				l = x + 1;
			else
				r = x - 1;
		}
	}
	return 0;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int q;
#ifdef _DEBUG
	q = 1;
#endif
	while (q--) {
		int k;
		cin >> n >> k;
		a.resize(n);

		cin >> a[0];
		for (int i = 1; i < n; i++) {
			int t;
			cin >> t;
			a[i] += a[i - 1] + t;
		}

		cout << (k = b_search(k)) << " ";
		if (k) cout << check(k);
		else cout << 0;
		cout << "\n";
	}
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n;
vector <int> a;

int check(int x) {
	return ((1 + x) * x / 2 * x) + a[x-1];
}

int b_search(int k) {
	int l = 1, r = n;
	while (l <= r) {
		int x = (r + l) / 2;
		if (check(x) <= k && (x + 1 > n || check(x+1) > k))
			return x;
		else {
			if (check(x) < k)
				l = x + 1;
			else
				r = x - 1;
		}
	}
	return 0;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int q = 1;
#ifdef _DEBUG
	q = 1;
#endif
	while (q--) {
		int k;
		cin >> n >> k;
		a.resize(n);

		cin >> a[0];
		for (int i = 1; i < n; i++) {
			int t;
			cin >> t;
			a[i] += a[i - 1] + t;
		}

		cout << (k = b_search(k)) << " ";
		if (k) cout << check(k);
		else cout << 0;
		cout << "\n";
	}
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 100009
#define ll  long long
int main(){
	ll sum=0,kk=0,hh=0;
	int x,q,ans=0;
	cin>>x>>q;
	int *a=new int [x+1];
	for (int i=1;i<=x;i++)
		cin>>a[i];
	for (int i=1;i<=x;i++)
	{
		sum=0;
		ll *y=new ll [x+1];
		y[0]=0;
		for (int j=1;j<=x;j++)
			y[j]=a[j]+i*j;
		sort(y,y+x+1);
		for (int j=1;j<=i;j++)
			sum=sum+y[j];
		if (sum<=q){
			ans=i;
			hh=ans;
			kk=sum;
		}
		else
			break;
	}

	cout<<hh<<" "<<kk<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 100009
#define ll  long long
int a[mod];
int main(){
	ll sum=0,kk=0,hh=0;
	int x,q,ans=0;
	cin>>x>>q;
	for (int i=1;i<=x;i++)
		cin>>a[i];
	for (int i=1;i<=x;i++)
	{
		sum=0;
		ll *y=new ll [x+1];
		y[0]=0;
		for (int j=1;j<=x;j++)
			y[j]=a[j]+i*j;
		sort(y,y+x+1);
		for (int j=1;j<=i;j++)
			sum=sum+y[j];
		if (sum<=q){
			ans=i;
			hh=ans;
			kk=sum;
		}
		else
			break;
	}

	cout<<hh<<" "<<kk<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 100009
#define ll  long long

int main(){
	/*ll x,c=0;
	cin>>x;
	int *y=new int [x];
	for (int i=0;i<x;i++)
		cin>>y[i];
	for (int i=0;i<x;i++)
	{
		if (c>=y[i])
		{
			cout<<i+1<<endl;
			break;
		}
		else
			c++;
		if (i==x-1)
			i=-1;
	}*/

	/*ll x;
	cin>>x;
	cout<<(x+1)*x*3+1<<endl;*/

	/*long long int sum=0;
	int x;
	cin>>x;
	for (long i=1;i<=x;i++)
	{
		sum=sum+(long long)powl(2,i);
	}
	cout<<sum<<endl;*/
	/*long double x,y;
	cin>>x>>y;
	printf("%.11lf\n",x*powl(1.000000011,y));*/
	/*ll x;
	cin>>x;
	cout<<(x%2==0?2:1)<<endl;*/
	/*int x,c=0,b=0;
	cin>>x;
	string s,k,l;
	cin>>s;
	k=s.substr(0,x);
	l=s.substr(x,s.length());
	sort(k.begin(),k.end());
	sort(l.begin(),l.end());
	for (int i=0;i<x;i++)
	{
		if (k[i]>l[i])
			b++;
		else if (k[i]<l[i])
			c++;
	}
	if (b==x ||c==x)
		cout<<"YES\n";
	else
		cout<<"NO\n";*/
	/*bool b=false;
	long long x,y,z;
	cin>>x>>y>>z;
	string s=to_string(x),d;
	for (long long i=0;i<=9;i++)
	{
		d=s+to_string(i);
		if (stoll(d)%y==0)
		{
			b=true;
			break;
		}
	}
	if (!b)
		cout<<"-1\n";
	else
	{
		cout<<d;
		for (int i=0;i<z-1;i++)
			cout<<0;
		cout<<endl;
	}*/

/*	long double h,l;
	cin>>h>>l;
	printf("%.9lf\n",(l*l-h*h)/(2*h));*/

	/*int q,x,mx=0;
	cin>>q;
	while (q--)
	{
		mx=0;
		map <int,int> m;
		cin>>x;
		int *y=new int [x];
		int *l=new int [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		for (int i=0;i<x;i++)
			cin>>l[i];
		for (int i=0;i<x;i++)
			m[y[i]-l[i]]++;
		map<int, int>::iterator itr;
		for (itr = m.begin(); itr != m.end(); ++itr) {
			mx=max(mx,itr->second);
			}
		cout<<mx<<endl;
	}*/

	/*int q,x,y;
	cin>>q;
	while (q--)
	{
		cin>>x>>y;
		if (__gcd(x,y)>1)
			cout<<"Sim\n";
		else
			cout<<"Nao\n";
	}*/

	/*int q,x,ans=0,y,k;
	cin>>q;
	while (q--)
	{
		cin>>x;
		for (int i=0;i<x;i++){
			cin>>y;
			l[y]++;
		}
		for(int i=0;i<x;i++)
		{
			cin>>k;

			if (l[k]==1)
				ans=k;

		}
		 memset(l,0,sizeof l);
		cout<<ans<<endl;
	}*/

	/*int c=0;
	char j;
	string s;
	cin>>s;
	j=s[0];
	for (int i=0;i<s.length();i++)
	{
		if (j==s[i])
			c++;
		else
		{
			v[j-'A'].push_back(c);
			c=1;
			j=s[i];
		}
	}
	v[j-'A'].push_back(c);
	cout<<s[0]<<v[s[0]-'A'][0];
	v[s[0]-'A'].pop_front();
	j=s[0];
	for (int i=0;i<s.length();i++)
	{
		if (j!=s[i])
		{
			cout<<s[i]<<v[s[i]-'A'][0];
			v[s[i]-'A'].pop_front();
			j=s[i];
		}

	}
	cout<<endl;*/

	/*bool b=false;
	int q,x,y,l;
	cin>>q;
	while (q--)
	{
		b=false;
		cin>>x>>y;
		while (x--)
		{

			cin>>l;
			if ((l+y)%7==0)
				b=true;
		}
		if (b)
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}*/

	/*bool b=false;
	int n,x,y,l,c=0,ans=0,k;
	cin>>n>>x>>y;
	int *q=new int [n+1];
	for (int i=0;i<n;i++)
		cin>>q[i];

	l=q[0];
	ans=0;
	for (int i=1;i<n;i++)
	{
		if (c==y ||(i==n-1 &&l<q[i]))
		{
			cout<<ans+1<<endl;
			b=true;
			break;
		}
		if (q[i]>l)
		{
			c++;
		}
		else
		{
			l=q[i];
			c=0;
			ans=i;
		}

	}
	if (!b)
		cout<<n<<endl;*/

	ll sum=0,kk=0,hh=0,r,l,mid;
	int x,q,ans=0;
	cin>>x>>q;
	l=1,r=x;
	int *a=new int [x+1];
	for (int i=1;i<=x;i++)
		cin>>a[i];
	while (l<=r){
		mid=(l+r)/2;
		sum=0;
		ll *y=new ll [x+1];
		y[0]=0;
		for (int j=1;j<=x;j++)
			y[j]=a[j]+mid*j;
		sort(y,y+x+1);
		for (int j=1;j<=mid;j++)
			sum=sum+y[j];
		if (sum<=q){
			ans=mid;
			hh=ans;
			kk=sum;
			l=mid+1;
		}
		else
			r=mid-1;
	}

	cout<<hh<<" "<<kk<<endl;

//	system("pause");
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 100009
#define ll  long long
int a[mod];
int main(){
	ll sum=0;
	int x,q,ans=0;
	cin>>x>>q;
	for (int i=1;i<=x;i++)
		cin>>a[i];
	for (int i=1;i<=x;i++)
	{
		sum=0;
		ll *y=new ll [x+1];
		y[0]=0;
		for (int j=1;j<=x;j++)
			y[j]=a[j]+i*j;
		sort(y,y+x+1);
		for (int j=1;j<=i;j++)
			sum=sum+y[j];
		if (sum<=q)
			ans=i;
		else
			break;
	}
	sum=0;
	ll *y=new ll [x+1];
	y[0]=-1;
	for (int j=1;j<=x;j++)
			y[j]=a[j]+ans*j;
	sort(y,y+x+1);
	for (int j=1;j<=ans;j++)
	{
		sum=sum+y[j];
	}
	cout<<ans<<" "<<sum<<endl;
	return 0;
}


#include<iostream>
#include<stack>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<ctime>
#include<math.h>
#include<functional>
#include<cstring>
#include<iomanip>
#include<set>
#include<utility>
#include<limits.h>
#include<stdio.h>

using namespace std;
const int maxn = 1e5 + 10;
int n, S;
struct Node
{
	int index, price;
}node[maxn];
long long b[maxn];
int maxnum = 0;
int BS()//��k���ж���
{
	int left = 0, right = n;
	long long mid ;
	long long sum;
	while (left < right)
	{
		mid = (left + right) / 2;
		sum = 0;
		for (int i = 1;i <= n;i++)
			b[i] = node[i].price + node[i].index *mid;
		sort(b + 1, b + 1 + n);
		for (int i = 1;i <= mid;i++)
			sum += b[i];
		if (sum > S) right = mid;
		else left = mid + 1;
	}
	return left;
}
int main()
{
	cin >> n >> S;
	for (int i = 1;i <= n;i++)
	{
		cin >> node[i].price;
		node[i].index = i;
	}
	int k = BS();
	if (k == n)
	{
		for (int i = 1;i <= n;i++)
			b[i] = node[i].price + node[i].index *k;
		sort(b + 1, b + 1 + n);
		long long sum = 0;
		for (int i = 1;i <= k;i++)
			sum += b[i];
		if (sum > S) k--;
	}
	else k--;
	for (int i = 1;i <= n;i++)
		b[i] = node[i].price + node[i].index *k;
	sort(b + 1, b + 1 + n);
	long long sum = 0;
	for (int i = 1;i <= k;i++)
		sum += b[i];
	cout << k << " " << sum;
	return ~~(0 - 0);
}


#include<iostream>
#include<stack>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<ctime>
#include<math.h>
#include<functional>
#include<cstring>
#include<iomanip>
#include<set>
#include<utility>
#include<limits.h>
#include<stdio.h>

using namespace std;
const int maxn = 1e5 + 10;
int n, S;
int a[maxn];
long long b[maxn];
int main()
{
	cin >> n >> S;
	for (int i = 1;i <= n;i++)
		cin >> a[i];
	sort(a + 1, a + 1 + n);
	b[1] = a[1] + 1;
	for (long long i = 2;i <= n;i++)
	{
		b[i] = (b[i - 1] + ((i - 1)*i) / 2);
		b[i] += (a[i] + i*i);
	}
	int res = upper_bound(b + 1, b + 1 + n, S) - b;
	res--;
	cout << res<<" "<< b[res];

	return ~~(0 - 0);
}