object Main {
  import java.util.Scanner
  import scala.collection.mutable
  
  def readStrings(n: Int)(implicit sc: Scanner): Array[String] = Array.fill(n) { sc.next() }
  def readInts(n: Int)(implicit sc: Scanner): Array[Int] = Array.fill(n) { sc.nextInt() }
  def readLongs(n: Int)(implicit sc: Scanner): Array[Long] = Array.fill(n) { sc.nextLong() }
  def readLineStrings(implicit sc: Scanner): Array[String] = sc.nextLine().split(' ')
  def readLineInts(implicit sc: Scanner): Array[Int] = readLineStrings.map(_.toInt)
  def readLineLongs(implicit sc: Scanner): Array[Long] = readLineStrings.map(_.toLong)

  def main(args: Array[String]): Unit = solve(new Scanner(System.in))

  case class Sequence(S: Long, carryCost: Long, lastGarbagePosition: Long) {
    def append(nextGarbage: Long): Sequence = {
      val S1 = S + nextGarbage
      val carryCost1 = carryCost + 3 * nextGarbage + 2 * S
      Sequence(S1, carryCost1, nextGarbage)
    }

    def costDifference(another: Sequence): Long = another.S - S

    def totalCost: Long = carryCost + lastGarbagePosition * 2
  }

  object Sequence {
    def apply(garbage: Long): Sequence = Sequence(garbage, 3 * garbage, garbage)
  }

  def solve(implicit sc: Scanner): Unit = {
    val Array(n, x) = readLineLongs
    val positions = readLineLongs
    val sequences = mutable.ArrayBuffer.empty[Sequence]

    positions.foreach(garbagePosition => {
      val newPathCost = 5 * garbagePosition + x
      val appendCosts = sequences.zipWithIndex.map { case(s, i) => (s.costDifference(s.append(garbagePosition)), i) }
      if (appendCosts.nonEmpty) {
        val (cheapest, index) = appendCosts.minBy(_._1)
        if (cheapest <= newPathCost) {
          sequences(index) = sequences(index).append(garbagePosition)
        } else {
          sequences += Sequence(garbagePosition)
        }
      } else {
        sequences += Sequence(garbagePosition)
      }
    })

    val answer = x * (sequences.size + n) + sequences.map(_.totalCost).sum
    println(answer)
  }
}
