#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[200100];
long long calc(int l, int r) {
  long long ret = a[r];
  for (int i = r; i > l; i--)
    ret += (long long)(r - i + 1 + 1) * (r - i + 1 + 1) * (a[i] - a[i - 1]);
  ret += (long long)(r - l + 1 + 1) * (r - l + 1 + 1) * (a[l]);
  return ret + m;
}
long long dp[200100];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  memset(dp, 0x3f, sizeof(dp));
  dp[0] = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < i; j++) dp[i] = min(dp[i], dp[j] + calc(j + 1, i));
  cout << dp[n] + (long long)n * m << endl;
  return 0;
}
