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