import scala.annotation.tailrec
import scala.io.StdIn._



object Main extends App {

  solve()
  @tailrec def solve(): Unit = {
    val Array(n, m) = readLine.trim.split(' ').map(_.toInt)
    if (n == 0 && m == 0){
      return
    }
    val money = readLine.trim.split(' ').map(_.toInt)
    println(money.map{a ⇒ Math.min(a, m / n)}.sum)
    solve()
  }
}


