object Main extends App {

  import scala.io.StdIn._
  import scala.math._
  val Array(n, m) = readLine.trim.split(' ').map(_.toInt)
  val inns = Array.tabulate(n - 1){_ ⇒ readLine.trim.toInt}.also{arr ⇒ (1 until arr.length).foreach(i ⇒ arr(i) += arr(i - 1))}.let{0 +: _}
  var current = 0
  var sumTime = 0L
  for (_ ← 0 until m){
    val a = readLine.trim.toInt
    sumTime += math.abs(inns(current + a) - inns(current))
    sumTime %= 100000
    current += a
  }
  println(sumTime)
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}
