function Main(input) {
  input = input.split("\n");
  const n = parseInt(input[0].split(" ")[0], 10);
  const A = input[1].split(" ").map(a => parseInt(a, 10));
  const B = input[2].split(" ").map(a => parseInt(a, 10));

  var count = 0;
  for (var i = 0; i < n; i++) {
    if (A[i] >= B[i]) {
      count += B[i];
      // console.log("a")
    } else {
      if ( A[i] - B[i] + A[i+1] > 0) {
        count += B[i];
        A[i+1] -= B[i] - A[i];
      // console.log("b")
      } else {
        count += A[i] + A[i+1];
        A[i+1] = 0;
      // console.log("c")
      }
    }
    // console.log(count)
  }
  console.log(count);

}


// *出力
// number
// console.log('%d', );
// string
// console.log('%s', );

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
