#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmin(T &a, T b) {
  return b < a ? a = b, 1 : 0;
}
inline int read() {
  register char c_;
  register int _, __;
  for (_ = 0, __ = 1, c_ = getchar(); !isdigit(c_); c_ = getchar())
    if (c_ == '-') __ = -1;
  for (; isdigit(c_); c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
  return _ * __;
}
const int maxn = 2e3 + 5;
int n, X, first[maxn];
long long dp[maxn];
int main() {
  n = read(), X = read();
  for (register int i = (1), i_end_ = (n); i <= i_end_; ++i) first[i] = read();
  for (register int i = (1), i_end_ = (n); i <= i_end_; ++i) {
    dp[i] = dp[i - 1] + X + (long long)first[i] * 5ll;
    long long sum = 0, tmp, sum_ = -1, tmp_ = -1;
    for (register int j = (i - 1), j_end_ = (1); j >= j_end_; --j) {
      sum += (long long)(first[j + 1] - first[j]) * (long long)(i - j + 1) *
             (long long)(i - j + 1);
      if (sum >= dp[i] || sum < sum_) break;
      tmp = (long long)(first[j]) * (long long)(i - j + 2) *
            (long long)(i - j + 2);
      if (tmp >= dp[i] || tmp < 0) continue;
      chkmin(dp[i], dp[j - 1] + sum + (long long)first[i] + (long long)X + tmp);
      tmp_ = tmp, sum_ = sum;
    }
  }
  cout << dp[n] + (long long)X * n << endl;
  return 0;
}
