n, m = gets.split.map(&:to_i)
s = []
(n-1).times { s << gets.to_i }
a = []
m.times { a << gets.to_i }

dist = [0]
s.each_with_index do |t, idx|
  dist[idx+1] = dist[idx] + t
end

cur_hotel = 0
moves = 0
# p s
# p dist
# p a

ans = 0
(a + [0]).each_with_index do |cur, i| # ???????????????????¢???????
  # p [cur_hotel, moves]
  if moves == 0 || (moves[-1] > 0 && cur > 0) || (moves[-1] < 0 && cur < 0)
    moves += cur
  else
    dx = dist[cur_hotel+moves] - dist[cur_hotel]
    ans += dx.abs
    cur_hotel += moves
    moves = cur
  end
end

puts ans