#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long f = 1, x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  return x * f;
}
const long long Pow = 10000000000000000ll;
long long x[5000 + 5], f[5000 + 5][5000 + 5][2], dp[5000 + 5][2];
int main() {
  int n = read(), p = read();
  for (int i = 1; i <= n; i++) x[i] = read();
  for (int i = 1; i <= n; i++) f[i][i][0] = 5ll * x[i];
  for (int i = 1; i <= n; i++)
    for (int j = i - 1; j >= 1; j--) {
      f[j][i][0] = f[j + 1][i][0] + (2ll * (i - j + 1) + 1ll) * x[j];
      f[j][i][1] = f[j][i][0] / Pow + f[j + 1][i][1], f[j][i][0] %= Pow;
    }
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0] = dp[0][1] = 0;
  for (int i = 1; i <= n; i++) dp[i][0] *= 10ll, dp[i][1] *= 10ll;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < i; j++) {
      long long tmp = dp[j][0] + f[j + 1][i][0] + 1ll * (i - j + 1) * p,
                t = dp[j][1] + f[j + 1][i][1] + tmp / Pow;
      if (t < dp[i][1])
        dp[i][1] = t, dp[i][0] = tmp % Pow;
      else if (t == dp[i][1])
        if (tmp % Pow < dp[i][0]) dp[i][0] = tmp % Pow;
    }
  if (dp[n][1]) printf("%lld", dp[n][1]);
  printf("%lld\n", dp[n][0]);
  return 0;
}
