import java.lang.Math.abs

fun main(args:Array<String>):Unit {
    while(true){
        val (n, m) = readLine()!!.trim().split(' ').map(String::toInt)
        if (n == 0 && m == 0) return
        val cell = Array(n){readLine()!!.trim().toInt()}
        var pos = 0
        var goaled = false
        repeat(m){
            pos += readLine()!!.trim().toInt()
            if (!goaled){
                if (pos >= n - 1){
                    goaled = true
                    println(it + 1)
                }
                else {
                    pos += cell[pos]
                    if (pos >= n - 1) {
                        goaled = true
                        println(it + 1)
                    }
                }
            }
        }
    }

}

