inns, days = gets.chomp.split(' ').map(&:to_i)
sections = []
(inns - 1).times do
  sections.push(gets.chomp.to_i)
end
sum = 0
sums = [0]
sections.each do |section|
  sum += section
  sums.push(sum)
end
plans = []
days.times do
  plans.push(gets.chomp.to_i)
end
current = 0
distance = 0
plans.each do |plan|
  start = sums[current]
  finish = sums[current + plan]
  distance += (start - finish).abs
  current += plan
end
puts distance % (10 ** 5)