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

BIT = [0] * (n + 1)

def add(i, x):

    while i <= n:

        BIT[i] += x

        i += i & -i

def query(i):

    s = 0

    while i > 0:

        s += BIT[i]

        i -= i & -i

    return s

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

for i in range(n):

    add(i + 1, a[i])

for i in range(q):

    x, y, z = list(map(int, input().split()))

    if x == 0:

        add(y + 1, z)

    else:

        print((query(z) - query(y)))
class BinaryIndexedTree():

    def __init__(self, n):

        self.n = n

        self.BIT = [0] * (self.n + 1)

    def add(self, i, x):

        while i <= self.n:

            self.BIT[i] += x

            i += i & -i

    def query(self, i):

        res = 0

        while i > 0:

            res += self.BIT[i]

            i -= i & -i

        return res

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

BIT = BinaryIndexedTree(n)

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

for i in range(n):

    BIT.add(i + 1, a[i])

for i in range(q):

    x, y, z = list(map(int, input().split()))

    if x == 0:

        BIT.add(y + 1, z)

    else:

        print((BIT.query(z) - BIT.query(y)))
n, q = list(map(int, input().split()))
BIT = [0] * (n + 1)


def add(i, x):
    while i <= n:
        BIT[i] += x
        i += i & -i


def query(i):
    s = 0
    while i > 0:
        s += BIT[i]
        i -= i & -i
    return s


a = list(map(int, input().split()))
for i in range(n):
    add(i + 1, a[i])
for i in range(q):
    x, y, z = list(map(int, input().split()))
    if x == 0:
        add(y + 1, z)
    else:
        print((query(z) - query(y)))

class BinaryIndexedTree:
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (self.n + 1)

    def add(self, i, x):
        while i <= self.n:
            self.BIT[i] += x
            i += i & -i

    def query(self, i):
        res = 0
        while i > 0:
            res += self.BIT[i]
            i -= i & -i
        return res


n, q = list(map(int, input().split()))
BIT = BinaryIndexedTree(n)
a = list(map(int, input().split()))
for i in range(n):
    BIT.add(i + 1, a[i])
for i in range(q):
    x, y, z = list(map(int, input().split()))
    if x == 0:
        BIT.add(y + 1, z)
    else:
        print((BIT.query(z) - BIT.query(y)))

-n, q = list(map(int, input().split())) -BIT = [0] * (n + 1) +class BinaryIndexedTree: +    def __init__(self, n): +        self.n = n +        self.BIT = [0] * (self.n + 1) + +    def add(self, i, x): +        while i <= self.n: +            self.BIT[i] += x +            i += i & -i + +    def query(self, i): +        res = 0 +        while i > 0: +            res += self.BIT[i] +            i -= i & -i +        return res -def add(i, x): -    while i <= n: -        BIT[i] += x -        i += i & -i - - -def query(i): -    s = 0 -    while i > 0: -        s += BIT[i] -        i -= i & -i -    return s - - +n, q = list(map(int, input().split())) +BIT = BinaryIndexedTree(n) -    add(i + 1, a[i]) +    BIT.add(i + 1, a[i]) -        add(y + 1, z) +        BIT.add(y + 1, z) -        print((query(z) - query(y))) +        print((BIT.query(z) - BIT.query(y)))