import sys

input=sys.stdin.readline

n,q=list(map(int,input().split()))



BIT=[0]*n

def ADD(x,y):#A[x]+=y,1-origin

	while x<=n:

		BIT[x-1]+=y

		x+=x&(-x)

def SUM(l):#1からlまでの和

	if l==0:

		return 0

	ret=0

	while l>=1:

		ret+=BIT[l-1]

		l-=l&(-l)

	return ret



IN=list(map(int,input().split()))

for i in range(n):

	ADD(i+1,IN[i])



for i in range(q):

	t,a,b=list(map(int,input().split()))

	if t==0:

		ADD(a+1,b)

	else:

		print((SUM(b)-SUM(a)))
import sys

input=sys.stdin.readline

n,q=list(map(int,input().split()))



BIT=[0]*n

def ADD(x,y):#A[x]+=y,1-origin

	while x<=n:

		BIT[x-1]+=y

		x+=x&(-x)

def SUM(l):#1からlまでの和

	ret=0

	while l>=1:

		ret+=BIT[l-1]

		l-=l&(-l)

	return ret



IN=list(map(int,input().split()))

for i in range(n):

	ADD(i+1,IN[i])



for i in range(q):

	t,a,b=list(map(int,input().split()))

	if t==0:

		ADD(a+1,b)

	else:

		print((SUM(b)-SUM(a)))
import sys

input = sys.stdin.readline
n, q = list(map(int, input().split()))
BIT = [0] * n


def ADD(x, y):  # A[x]+=y,1-origin
    while x <= n:
        BIT[x - 1] += y
        x += x & (-x)


def SUM(l):  # 1からlまでの和
    if l == 0:
        return 0
    ret = 0
    while l >= 1:
        ret += BIT[l - 1]
        l -= l & (-l)
    return ret


IN = list(map(int, input().split()))
for i in range(n):
    ADD(i + 1, IN[i])
for i in range(q):
    t, a, b = list(map(int, input().split()))
    if t == 0:
        ADD(a + 1, b)
    else:
        print((SUM(b) - SUM(a)))

import sys

input = sys.stdin.readline
n, q = list(map(int, input().split()))
BIT = [0] * n


def ADD(x, y):  # A[x]+=y,1-origin
    while x <= n:
        BIT[x - 1] += y
        x += x & (-x)


def SUM(l):  # 1からlまでの和
    ret = 0
    while l >= 1:
        ret += BIT[l - 1]
        l -= l & (-l)
    return ret


IN = list(map(int, input().split()))
for i in range(n):
    ADD(i + 1, IN[i])
for i in range(q):
    t, a, b = list(map(int, input().split()))
    if t == 0:
        ADD(a + 1, b)
    else:
        print((SUM(b) - SUM(a)))

-    if l == 0: -        return 0