#include <bits/stdc++.h>
using namespace std;
const int N = 200200;
long long d[N];
multiset<long long> S;
multiset<long long> V;
int main() {
  long long n, x;
  cin >> n >> x;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }
  long long res = d[n - 1] * 5 + x;
  long long ans = res;
  S.insert(1);
  V.insert(1e18);
  for (int i = n - 2; i >= 0; i--) {
    long long u = *(S.begin());
    long long res1, res2;
    res1 = (x + d[i] * 5);
    res2 = ((u + 2) * (u + 2) - (u + 1) * (u + 1)) * d[i];
    if (res1 <= res2) {
      res += res1;
      S.insert(1);
    } else {
      S.erase(S.begin());
      long long k = *(V.begin());
      if (k < (res1 - res2)) {
        res += (res1 - res2 - k);
        S.insert(2);
        V.erase(V.begin());
      } else {
        V.insert(res1 - res2);
        res += res2;
        S.insert(u + 1);
      }
    }
  }
  res += x * n;
  cout << res;
  return 0;
}
