#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 5;
const int mod = 1e9 + 7;
const long long inf = (1ll << 62);
const int block = 700;
long long x[maxn], ans[maxn], num[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  long long n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> x[i];
  set<pair<long long, long long> > s;
  for (int i = n; i >= 1; i--) {
    long long ted, add = inf;
    if (!s.empty()) {
      auto it = *s.begin();
      ted = it.first, add = x[i] * (2 * ted + 3);
    }
    long long add2 = k + x[i] + 4 * x[i];
    if (add <= add2) {
      auto it = *s.begin();
      s.erase(s.begin());
      ans[it.second] += add;
      num[it.second]++;
      s.insert({num[it.second], it.second});
    } else {
      s.insert({1, i});
      num[i] = 1;
      ans[i] = add2;
    }
  }
  long long sum = n * k;
  for (auto i : s) sum += ans[i.second];
  cout << sum << endl;
}
