import scala.math._
import scala.collection.mutable.ListBuffer

object Main {
  //rt.gc()??§??¬??????????????¬?????????????????????
  //val rt = Runtime.getRuntime()
  val sc = new java.util.Scanner(System.in)
  def solve(sai: Iterator[Int], mas:Array[Int], p: Int): Int = {
    if(p < mas.size - 1) {
      val s = sai.next()
      if(p+s < mas.size-1) {
        1 + solve(sai, mas, p+s+mas(p+s))
      } else {
        1
      }
    } else {
      0
    }
  } 
  def main(args: Array[String]) {
    while(true) {
      val n,m = sc.nextInt
      if((n,m) == (0,0)) {
        return
      }

      val masu = (1 to n).map(_ => sc.nextInt()).toArray
      var p = 0
      val sai = (1 to m).map(_ => sc.nextInt()).toIterator
      println(solve(sai, masu, 0))
    }
  }
}