#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17;
const long long NEGA = -INF;
long long x[20001];
long long k = 0;
long long ans = 0;
long long ansss[20001][10000];
int main() {
  long long n;
  cin >> n;
  long long X;
  cin >> X;
  for (long long i = 0; i < n; i++) cin >> x[i];
  long long tail = n - 1;
  long long head = 0;
  long long ppp[20001] = {0};
  while (head <= tail) {
    ans += x[tail];
    k = 1;
    while ((k + 2) * (k + 2) * x[head] <=
           2 * x[head] + (k + 1) * (k + 1) * x[head]) {
      head++;
      k++;
      if (head == tail) break;
    }
    ansss[tail][ppp[tail]++] += 4 * (x[tail] - x[head]);
    int j = 1;
    for (int i = head; i > 0; --i) {
      ansss[i][ppp[i]++] += (j + 1) * (j + 1) * (x[i] - x[i - 1]);
      j++;
    }
    if (x[0]) {
      ansss[0][ppp[0]++] += (j + 1) * (j + 1) * x[0];
    }
    if (head < tail) ans += X;
    tail--;
  }
  ans += X * n;
  for (int i = 0; i < n; ++i) sort(ansss[i], ansss[i] + ppp[i]);
  for (int i = 0; i < n; ++i) ans += ansss[i][0];
  cout << ans << endl;
}
