loop do
  n, m = gets.split.map(&:to_i)
  
  break if n == 0
  
  arr1, cur, flg = n.times.map{ gets.to_i }, 0, false
  
  m.times do |i|
    cur += gets.to_i
    
    if cur >= n - 1 && !flg
      puts i + 1
      flg = true
    end
    
    cur += arr1[cur]
    
    if cur >= n - 1 && !flg
      puts i + 1
      flg = true
    end
  end
end