import sys

input = sys.stdin.buffer.readline





class BinaryIndexedTree:

    """一点加算、区間総和クエリをそれぞれO(logN)で答えるデータ構造。"""

    def __init__(self, n):

        self.size = n

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



    def build(self, array):

        """arrayを初期値とするBinaryIndexedTreeを構築する。O(N)"""

        for i, val in enumerate(array):

            self.bit[i + 1] = val

        for i in range(1, self.size):

            if i + (i & -i) > self.size:

                continue

            self.bit[i + (i & -i)] += self.bit[i]



    def _sum(self, i):

        s = 0

        while i > 0:

            s += self.bit[i]

            i -= i & -i

        return s



    def add(self, i, val):

        """i番目の要素にvalを加算する。O(logN)"""

        i += 1

        while i <= self.size:

            self.bit[i] += val

            i += i & -i



    def sum(self, l, r):

        """区間[l, r)の和を求める。O(logN)"""

        return self._sum(r) - self._sum(l)



    def bisect_left(self, val):

        """区間[0, ind)の和がval以上になる最小のindを求める。O(logN)"""

        if val <= 0:

            return 0

        ind = 0

        k = 1 << self.size.bit_length()

        while k:

            if ind + k <= self.size and self.bit[ind + k] < val:

                val -= self.bit[ind + k]

                ind += k

            k >>= 1

        return ind + 1





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

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

queries = [list(map(int, input().split())) for _ in range(q)]





bit = BinaryIndexedTree(n)

bit.build(a)

for flag, l, r in queries:

    if flag:

        print((bit.sum(l, r)))

    else:

        bit.add(l, r)  # l = index, r = val
import sys

input = sys.stdin.buffer.readline





class BinaryIndexedTree:

    """一点加算、区間総和クエリをそれぞれO(logN)で答えるデータ構造。"""

    def __init__(self, n):

        self.size = n

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



    def build(self, array):

        """arrayを初期値とするBinaryIndexedTreeを構築する。O(N)"""

        for i, val in enumerate(array):

            self.bit[i + 1] = val

        for i in range(1, self.size):

            if i + (i & -i) > self.size:

                continue

            self.bit[i + (i & -i)] += self.bit[i]



    def _sum(self, i):

        s = 0

        while i > 0:

            s += self.bit[i]

            i -= i & -i

        return s



    def add(self, i, val):

        """i番目の要素にvalを加算する。O(logN)"""

        i += 1

        while i <= self.size:

            self.bit[i] += val

            i += i & -i



    def sum(self, l, r):

        """区間[l, r)の和を求める。O(logN)"""

        return self._sum(r) - self._sum(l)



    def bisect_left(self, val):

        """区間[0, ind)の和がval以上になる最小のindを求める。O(logN)"""

        if val <= 0:

            return 0

        ind = 0

        k = 1 << self.size.bit_length()

        while k:

            if ind + k <= self.size and self.bit[ind + k] < val:

                val -= self.bit[ind + k]

                ind += k

            k >>= 1

        return ind + 1





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

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

queries = [list(map(int, input().split())) for _ in range(q)]





bit = BinaryIndexedTree(n)

bit.build(a)

ans = []

for flag, l, r in queries:

    if flag:

        ans.append(bit.sum(l, r))

    else:

        bit.add(l, r)  # l = index, r = val



print(("\n".join(map(str, ans))))
import sys

input = sys.stdin.buffer.readline


class BinaryIndexedTree:
    """一点加算、区間総和クエリをそれぞれO(logN)で答えるデータ構造。"""

    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n + 1)

    def build(self, array):
        """arrayを初期値とするBinaryIndexedTreeを構築する。O(N)"""
        for i, val in enumerate(array):
            self.bit[i + 1] = val
        for i in range(1, self.size):
            if i + (i & -i) > self.size:
                continue
            self.bit[i + (i & -i)] += self.bit[i]

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

    def add(self, i, val):
        """i番目の要素にvalを加算する。O(logN)"""
        i += 1
        while i <= self.size:
            self.bit[i] += val
            i += i & -i

    def sum(self, l, r):
        """区間[l, r)の和を求める。O(logN)"""
        return self._sum(r) - self._sum(l)

    def bisect_left(self, val):
        """区間[0, ind)の和がval以上になる最小のindを求める。O(logN)"""
        if val <= 0:
            return 0
        ind = 0
        k = 1 << self.size.bit_length()
        while k:
            if ind + k <= self.size and self.bit[ind + k] < val:
                val -= self.bit[ind + k]
                ind += k
            k >>= 1
        return ind + 1


n, q = list(map(int, input().split()))
a = list(map(int, input().split()))
queries = [list(map(int, input().split())) for _ in range(q)]
bit = BinaryIndexedTree(n)
bit.build(a)
for flag, l, r in queries:
    if flag:
        print((bit.sum(l, r)))
    else:
        bit.add(l, r)  # l = index, r = val

import sys

input = sys.stdin.buffer.readline


class BinaryIndexedTree:
    """一点加算、区間総和クエリをそれぞれO(logN)で答えるデータ構造。"""

    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n + 1)

    def build(self, array):
        """arrayを初期値とするBinaryIndexedTreeを構築する。O(N)"""
        for i, val in enumerate(array):
            self.bit[i + 1] = val
        for i in range(1, self.size):
            if i + (i & -i) > self.size:
                continue
            self.bit[i + (i & -i)] += self.bit[i]

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

    def add(self, i, val):
        """i番目の要素にvalを加算する。O(logN)"""
        i += 1
        while i <= self.size:
            self.bit[i] += val
            i += i & -i

    def sum(self, l, r):
        """区間[l, r)の和を求める。O(logN)"""
        return self._sum(r) - self._sum(l)

    def bisect_left(self, val):
        """区間[0, ind)の和がval以上になる最小のindを求める。O(logN)"""
        if val <= 0:
            return 0
        ind = 0
        k = 1 << self.size.bit_length()
        while k:
            if ind + k <= self.size and self.bit[ind + k] < val:
                val -= self.bit[ind + k]
                ind += k
            k >>= 1
        return ind + 1


n, q = list(map(int, input().split()))
a = list(map(int, input().split()))
queries = [list(map(int, input().split())) for _ in range(q)]
bit = BinaryIndexedTree(n)
bit.build(a)
ans = []
for flag, l, r in queries:
    if flag:
        ans.append(bit.sum(l, r))
    else:
        bit.add(l, r)  # l = index, r = val
print(("\n".join(map(str, ans))))

+ans = [] -        print((bit.sum(l, r))) +        ans.append(bit.sum(l, r)) +print(("\n".join(map(str, ans))))