import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val as = Array.fill(n + 1)(sc.nextInt())
    val bs = Array.fill(n)(sc.nextInt())

    var ans = 0
    for (i <- bs.indices) {
      val one = math.min(as(i), bs(i))
      ans += one
      val more = bs(i) - one
      val two = math.min(as(i + 1), more)
      ans += two
      as(i + 1) -= two
    }

    println(ans)
  }
}
