#include <bits/stdc++.h>
using namespace std;
long long n, X, x[2004], c[2004][2004], dp[2004];
long long cost(long long i, long long j) {
  if (i == j) {
    return x[i];
  }
  if (c[i][j] != -1) return c[i][j];
  return c[i][j] =
             cost(i, j - 1) + (j - i + 1) * (j - i + 1) * (x[j] - x[j - 1]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> X;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  long long ans = x[n - 1] + n * X;
  long long cur = n - 2;
  long long start = n - 1;
  while (cur >= 0) {
    if ((x[cur + 1] - x[cur]) * (start - cur + 1) * (start - cur + 1) +
            x[cur] * (start - cur + 2) * (start - cur + 2) <
        X + x[cur + 1] * (start - cur + 1) * (start - cur + 1) + x[cur] * 5) {
      ans += (x[cur + 1] - x[cur]) * (start - cur + 1) * (start - cur + 1);
    } else {
      ans += X + x[cur + 1] * (start - cur + 1) * (start - cur + 1) + x[cur];
      start = cur;
    }
    cur--;
  }
  ans += X + x[0] * (start + 2) * (start + 2);
  cout << ans;
  return 0;
}
