# coding: utf-8

nm = gets.chomp.split()
n = nm[0].to_i
m = nm[1].to_i
si = Array.new(n)
for i in 0..n-2
  si[i] = gets.chomp.to_i
end
sum_ary = [0]
for i in 0..n-2
  sum_ary.push(sum_ary[i]+si[i])
end

#puts  "#{1}:#{sum_ary} "

  
place =0
sum =0
before = 0
for i in 0..m-1
 # puts "?????¨??????:?????´???#{place}"
  t = gets.chomp.to_i

  before = place
  if place + t > n-1
    place = 100
  elsif place + t < 0
    place = 0
  else
    place += t
  end
  
    #puts "?§???????:?????´???#{place}"
  sub = sum_ary[place] - sum_ary[before]
 
  if sub <0
    sub =  sub * (-1)
  end
  sum += sub
 # puts "?§?????????¢#{sub},????§?????????¢#{sum}"
end

puts sum