#include <bits/stdc++.h>
long calc_one_clean(std::vector<long>& gars, long X) {
  long collected = 1;
  long long energy = gars[gars.size() - 1] + X;
  for (int i = gars.size() - 2; i >= 0; i--) {
    energy += (collected + 1) * (collected + 1) * (gars[i + 1] - gars[i]);
    if ((2 * (collected + 1) - 4) * gars[i] - X > 0) {
      long long e = (collected + 1) * (collected + 1) * gars[i] + X;
      energy += e;
      break;
    }
    energy += X;
    collected++;
  }
  if (collected == (int)gars.size()) {
    energy += gars[0] * (collected + 1) * (collected + 1) + X;
  }
  gars.erase(gars.end() - collected, gars.end());
  return energy;
}
int main() {
  int N, X;
  std::cin >> N >> X;
  std::vector<long> garbages(N);
  for (int i = 0; i < N; i++) {
    std::cin >> garbages[i];
  }
  long long energy = 0;
  while (garbages.size() > 0) {
    energy += calc_one_clean(garbages, X);
  }
  std::cout << energy << std::endl;
  return 0;
}
