class BinaryIndexedTree
  def initialize(arg)
    if arg.is_a?(Array)
      @n   = arg.size
      @bit = Array.new(@n + 1){ 0 }
      arg.each_with_index { |e, i| add(i, e) }  
    else
      @n   = arg
      @bit = Array.new(@n + 1){ 0 }
    end
  end

  def sum(i)
    i += 1
    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(a)

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-1) - bit.sum(l-1)
  end
end