class BinaryIndexedTree
  def initialize(n)
    @n   = n
    @bit = Array.new(n + 1){ 0 }
  end

  def sum(i)
    res = 0
    while i > 0
      res += @bit[i]
      i -= ( i & -i )
    end
    res
  end

  def add(i, x)
    i += 1
    while i <= @n
      @bit[i] += x
      i += ( i & -i )
    end
  end
end

n, q = gets.split.map { |e| e.to_i }
a    = gets.split.map { |e| e.to_i }

bit = BinaryIndexedTree.new(n)
a.each_with_index { |e, i| bit.add(i, e) }

q.times do
  query = gets.split.map { |e| e.to_i }
  
  if query[0] == 0
    _, q, x = query
    bit.add(q, x)
  else
    _, l, r = query
    puts bit.sum(r) - bit.sum(l)
  end
end