class BIT
  attr_accessor(:size, :table)

  def initialize(n)
    @size = n
    @table = Array.new(@size + 1, 0)
  end

  def add(p, x)
    p += 1
    while p <= @size
      @table[p] += x
      p += p & (- p)
    end
  end

  def sum(r)
    s = 0
    while r > 0
      s += @table[r]
      r -= r & (- r)
    end
    return s
  end
  
  def range(l, r)
    return sum(r) - sum(l)
  end
end

n, q = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
bit = BIT.new(n)
n.times do |i|
  bit.add(i, a[i])
end

q.times do
  t, *rest = gets.chomp.split.map(&:to_i)
  if t == 0
    p, x = rest
    bit.add(p, x)
  elsif t == 1
    l, r = rest
    puts bit.range(l, r)
  end
end