# Fenwick Tree
class FenwickTree
  def initialize(arg)
    if arg.is_a?(Array)
      @n   = arg.size
      @data = Array.new(@n + 1) { 0 }
      arg.each_with_index { |e, i| add(i + 1, e) }
    elsif arg.is_a?(Integer)
      @n   = arg
      @data = Array.new(@n + 1) { 0 }
    else
      raise ArgumentError.new
    end
  end

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

  def sum(l, r)
    _sum(r) - _sum(l)
  end

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

FeTree            = FenwickTree
BinaryIndexedTree = FenwickTree

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

ft = FeTree.new(a)

q.times do
  t, u, v = gets.split.map { |e| e.to_i }

  if t == 0
    ft.add(u + 1, v)
  else
    puts ft.sum(u, v)
  end
end
