/*input
10 8851025
38 87 668 3175 22601 65499 90236 790604 4290609 4894746
*/
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 2000 + 100, oo = 1ll << 60;
int v[MX];
int gap = 0;
main () {
    int n, x; cin >> n >> x;
    if(n >= 2000) gap = sqrt(n);
    int ans = 0;
    multiset<int> s; s.insert(0);
    for(int i = 1; i <= n; i ++) cin >> v[i];
    for(int i = n; i >= 1; i --) {
        int p = *s.begin(); s.erase(s.begin());
        int va = v[i] * (p + 1) * (p + 1) + v[i] + v[i] * 2 * 2 + x;
        int vb = v[i] * (p + 2) * (p + 2);
        if(p == 0 or va - vb >= gap) {
            p ++;
            s.insert(p);
            if(p == 1) {
                ans += (p + 1) * (p + 1) * v[i];
            }
            else {
                ans += ((p + 1) * (p + 1) - (p) * (p)) * v[i];
            }
        }
        else {
            s.insert(p);
            ans += v[i] * 2 * 2 + x + v[i];
            s.insert(1);
        }
    }
    cout << ans + n * x + x + v[n];
}