import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    val Array(n, m) = sc.nextLine.split(" ").map(_.toInt)
    val sortedInput = List.fill(n, 2)(sc.nextInt).sortWith((a, b) => a.head < b.head)

    @annotation.tailrec
    def go(m: Long, i: Int, acc: Long): Long = {
      if (m == 0) acc
      else {
        if (m > sortedInput(i)(1)) go(m - sortedInput(i)(1), i + 1, acc + sortedInput(i).head * sortedInput(i)(1))
        else go(0, 0, acc + m * sortedInput(i).head)
      }
    }

    println(go(m, 0, 0))

  }

}
