import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)


  val N = in.next().toInt
  val X = in.next().toLong
  val x = new Array[Long](N+1)

  for(i <- 1 to N)
    x(i) = in.next().toLong


  if(N > 2000){
    ???
  }


  //
  val dp = new Array[BigInt](N+2)
  for(i <- 0 to N)
    dp(i) = Long.MaxValue


  val leftMoveTable = Array.ofDim[Long](N+1, N+1) // take r to l's garbage to left
  for (r <- (1 to N).reverse) {
    leftMoveTable(r)(r) = (1L + 1) * (1L + 1) * x(r)
    var cnt = 0L
    for (l <- (1 to r-1).reverse) {
      val gomiNum = r - l + 1L
      val d = x(l+1) - x(l)

      cnt += (gomiNum + 1 -1) * (gomiNum + 1 -1) * d
      leftMoveTable(l)(r) = (gomiNum+1)*(gomiNum+1)*x(l) + cnt
    }
  }
  //leftMoveTable.foreach{x => println(x.deep)}

  def getLeftMove(l: Int, r: Int): Long = {
    leftMoveTable(l)(r)
  }

  def calc(l: Int, r: Int): BigInt = {
    var res: BigInt = x(r) // to right move
    res += dp(r+1)
    res += getLeftMove(l, r) // to left move
    res += (r - (l-1)).toLong * X // pick garbage
    res += X // throw garbage
    res
  }

  dp(N+1) = 0
  for (l <- (1 to N).reverse) {
    for (r <- (l to N).reverse) {
      dp(l) = dp(l) min calc(l, r)
    }
  }

  val ans = dp(1)
  println(ans)

}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
