n, m = gets.split.map &:to_i
s = (1..n-1).map{ gets.to_i }
d = s.inject([0]){|a, x| a + [(a[-1] + x) % 100000]}
k = 0
total = 0
m.times {
    a = gets.to_i
    total = (total + (d[k + a] - d[k]).abs) % 100000
    k += a
}
p total