N,Q = list(map(int,input().split()))

BIT = [0]*(N+1)



def BIT_query(idx):

    res_sum = 0

    while idx > 0:

        res_sum += BIT[idx]

        idx -= idx&(-idx)

    return res_sum



def BIT_update(idx,x):

    while idx <= N:

        BIT[idx] += x

        idx += idx&(-idx)

    return



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

for i in range(N):

    BIT_update(i+1,a[i])



for i in range(Q):

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

    if a == 0:

        BIT_update(b+1,c)

    else:

        print((BIT_query(c)-BIT_query(b)))

import sys

input = sys.stdin.buffer.readline

N,Q = list(map(int,input().split()))

BIT = [0]*(N+1)



def BIT_query(idx):

    res_sum = 0

    while idx > 0:

        res_sum += BIT[idx]

        idx -= idx&(-idx)

    return res_sum



def BIT_update(idx,x):

    while idx <= N:

        BIT[idx] += x

        idx += idx&(-idx)

    return



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

for i in range(N):

    BIT_update(i+1,a[i])



for i in range(Q):

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

    if a == 0:

        BIT_update(b+1,c)

    else:

        print((BIT_query(c)-BIT_query(b)))

N, Q = list(map(int, input().split()))
BIT = [0] * (N + 1)


def BIT_query(idx):
    res_sum = 0
    while idx > 0:
        res_sum += BIT[idx]
        idx -= idx & (-idx)
    return res_sum


def BIT_update(idx, x):
    while idx <= N:
        BIT[idx] += x
        idx += idx & (-idx)
    return


a = list(map(int, input().split()))
for i in range(N):
    BIT_update(i + 1, a[i])
for i in range(Q):
    a, b, c = list(map(int, input().split()))
    if a == 0:
        BIT_update(b + 1, c)
    else:
        print((BIT_query(c) - BIT_query(b)))

import sys

input = sys.stdin.buffer.readline
N, Q = list(map(int, input().split()))
BIT = [0] * (N + 1)


def BIT_query(idx):
    res_sum = 0
    while idx > 0:
        res_sum += BIT[idx]
        idx -= idx & (-idx)
    return res_sum


def BIT_update(idx, x):
    while idx <= N:
        BIT[idx] += x
        idx += idx & (-idx)
    return


a = list(map(int, input().split()))
for i in range(N):
    BIT_update(i + 1, a[i])
for i in range(Q):
    a, b, c = list(map(int, input().split()))
    if a == 0:
        BIT_update(b + 1, c)
    else:
        print((BIT_query(c) - BIT_query(b)))

+import sys + +input = sys.stdin.buffer.readline