n, m = map(int, input().split())
a = list(map(int, input().split()))
class tree():
def __init__(self, l, r, a):
self.l = l
self.r = r
self.v = 0
if l == r:
self.v = a[l]
else:
mid = (l + r) >> 1
self.lnode = tree(l, mid, a)
self.rnode = tree(mid+1, r, a)
self.v = self.lnode.v + self.rnode.v
def update(self, i, x):
self.v += x
mid = (self.l + self.r) >> 1
if self.l == self.r:
return
if i <= mid:
self.lnode.update(i, x)
else:
self.rnode.update(i, x)
def query(self, i, j):
if i == self.l and j == self.r:
return self.v
mid = (self.l + self.r) >> 1
if j <= mid:
return self.lnode.query(i, j)
elif i > mid:
return self.rnode.query(i, j)
else:
return self.lnode.query(i, mid) + self.rnode.query(mid+1,j)
rt = tree(0, n-1, a)
for _ in range(m):
k, a, b = map(int, input().split())
if k == 0:
print(rt.query(a-1, b-1))
else:
rt.update(a-1, b)