class FeTree
    def initialize(n)
        @n = n
        @f = Array.new(@n+1,0)
    end

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

    def sum(i)
        s = 0
        while i > 0
            s += @f[i]
            i &= i-1
        end
        s
    end
end

n, q = gets.split.map &:to_i
a = gets.split.map &:to_i

ft = FeTree.new(n)
a.each_with_index {|e,i| ft.add(i+1, e)}

q.times do
    t, x, y = gets.split.map &:to_i
    if t == 0
        ft.add(x+1, y)
    else
        puts ft.sum(y) - ft.sum(x)
    end
end