class FenwickTree
    def initialize(n)
        @data = Array.new(n){0}
    end
    def add(i, x)
        i += 1
        while i <= @data.size
            @data[i - 1] += x
            i += i & -i
        end
    end
    def sum(r)
        s = 0
        while r > 0
            s += @data[r - 1]
            r -= r & -r
        end
        s
    end
end 

N,Q=gets.split.map(&:to_i)
ft=FenwickTree.new(N)
A=gets.split.map(&:to_i)
N.times{|i|
	ft.add(i, A[i])
}
Q.times{
	q,a,b=gets.split.map(&:to_i)
	case q
	when 0
		ft.add(a, b)
	when 1
		puts ft.sum(b)-ft.sum(a)
	end
}
