import sys

input = lambda: sys.stdin.readline()



class BIT:

    def __init__(self, n):

        self.n = n

        self.data = [0] * n



    def sum(self, i):

        s = 0

        while i > 0:

            s += self.data[i - 1]

            i &= i - 1

        return s



    def update(self, i, x):

        while i < self.n:

            self.data[i] += x

            i |= i + 1

        return





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

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

b = BIT(n)

for i in range(n):

    b.update(i, c[i])



res = []

for i in range(m):

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

    if t == 1:

        res.append(b.sum(y) - b.sum(x))

    else:

        b.update(x, y)

print(("\n".join(map(str, res))))

import sys

input = lambda: sys.stdin.readline()





class BIT:

    def __init__(self, n):

        self.n = n

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



    def sum(self, i):

        s = 0

        while i > 0:

            s += self.data[i]

            i -= i & -i

        return s



    def add(self, i, x):

        while i <= self.n:

            self.data[i] += x

            i += i & -i





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

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

b = BIT(n)

for i in range(n):

    b.add(i + 1, c[i])



res = []

for i in range(m):

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

    if t == 1:

        res.append(b.sum(y) - b.sum(x))

    else:

        b.add(x + 1, y)

print(("\n".join(map(str, res))))

import sys

input = lambda: sys.stdin.readline()


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

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i - 1]
            i &= i - 1
        return s

    def update(self, i, x):
        while i < self.n:
            self.data[i] += x
            i |= i + 1
        return


n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
b = BIT(n)
for i in range(n):
    b.update(i, c[i])
res = []
for i in range(m):
    t, x, y = list(map(int, input().split()))
    if t == 1:
        res.append(b.sum(y) - b.sum(x))
    else:
        b.update(x, y)
print(("\n".join(map(str, res))))

import sys

input = lambda: sys.stdin.readline()


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

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

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


n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
b = BIT(n)
for i in range(n):
    b.add(i + 1, c[i])
res = []
for i in range(m):
    t, x, y = list(map(int, input().split()))
    if t == 1:
        res.append(b.sum(y) - b.sum(x))
    else:
        b.add(x + 1, y)
print(("\n".join(map(str, res))))

-        self.data = [0] * n +        self.data = [0] * (n + 1) -            s += self.data[i - 1] -            i &= i - 1 +            s += self.data[i] +            i -= i & -i -    def update(self, i, x): -        while i < self.n: +    def add(self, i, x): +        while i <= self.n: -            i |= i + 1 -        return +            i += i & -i -    b.update(i, c[i]) +    b.add(i + 1, c[i]) -        b.update(x, y) +        b.add(x + 1, y)