#include <bits/stdc++.h>
using namespace std;
template <class T>
long long size(const T &x) {
  return x.size();
}
const long long INF = ~(1 << 31);
const double pi = acos(-1);
const double EPS = 1e-9;
int N, X;
vector<long long> A;
long long memo[2050];
long long dp(long long at) {
  if (at == N) return 0;
  if (memo[at] != -1) return memo[at];
  long long bst = -1;
  for (long long i = (at); i < (N); i++) {
    long long cost = (i - at + 1) * X + A[i] + X;
    long long aremany = (i - at + 1);
    long long tots = 1;
    for (int j = i - 1; j >= at; j--) {
      if ((A[j + 1] - A[j]) * (tots + 1) * (tots + 1) >
          X * 3 + A[i] + 1000000000) {
        return memo[at] = bst;
      }
      cost += (A[j + 1] - A[j]) * (tots + 1) * (tots + 1);
      tots++;
    }
    cost += A[at] * (tots + 1) * (tots + 1);
    cost += dp(i + 1);
    if (bst == -1)
      bst = cost;
    else
      bst = min(cost, bst);
  }
  return memo[at] = bst;
}
int main() {
  cin.sync_with_stdio(false);
  memset(memo, -1, sizeof(memo));
  cin >> N >> X;
  A = vector<long long>(N);
  for (long long i = (0); i < (N); i++) cin >> A[i];
  cout << dp(0) << endl;
  return 0;
}
