### main

loop do
  n, m = gets.strip.split(' ').map{|s| s.to_i}
  break if (n | m) == 0

  masu = n.times.map{gets.strip.to_i}
  ds = m.times.map{gets.strip.to_i}
  #p masu
  #p ds

  goal = n - 1
  x = 0
  num = 0

  for d in ds
    num += 1
    x += d
    break if x >= goal
    x += masu[x]
    break if x >= goal
  end

  puts num
end