import sys

input = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 7)





class BinaryIndexTree:  # 1-indexed

    def __init__(self, N):

        """

        INPUT

        N [int] -> 全部0で初期化

        N [list] -> そのまま初期化

        """

        if isinstance(N, int):

            self.N = N

            self.depth = N.bit_length()

            self.tree = [0] * (N + 1)

            self.elem = [0] * (N + 1)

        elif isinstance(N, list):

            self.N = len(N)

            self.depth = self.N.bit_length()

            self.tree = [0] + N

            self.elem = [0] + N

            self._init()

        else:

            raise "INVALID INPUT: input must be int or list"



    def _init(self):

        size = self.N

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

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

                continue

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



    def show(self):

        print((*self.elem))



    def add(self, i, x):

        self.elem[i] += x

        while i <= self.N:

            self.tree[i] += x

            i += i & -i



    def sum(self, i):

        res = 0

        while i > 0:

            res += self.tree[i]

            i -= i & -i

        return res



    def lower_bound(self, val):

        if val <= 0:

            return 0

        i = 0

        k = 1 << self.depth

        while k:

            if i + k <= self.N and self.tree[i + k] < val:

                val -= self.tree[i + k]

                i += k

            k >>= 1

        return i + 1





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

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

bit = BinaryIndexTree(A)



for _ in range(Q):

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

    if t == 0:

        bit.add(a + 1, b)

    else:

        print((bit.sum(b) - bit.sum(a)))
code = r"""

# distutils: language=c++

# distutils: include_dirs = [/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]

from libcpp cimport *



cdef extern from "/opt/atcoder-stl/atcoder/fenwicktree.hpp" namespace "atcoder":

    cdef cppclass fenwick_tree[T]:

        fenwick_tree()

        fenwick_tree(int n)

        void add(int a, T x)

        T sum(int l, int r)



import sys

input = sys.stdin.buffer.readline



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

cdef fenwick_tree[long] bit 

bit = fenwick_tree[long](N)



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

for i, a in enumerate(A):

    bit.add(i, a)



for _ in range(Q):

    t, u, v = map(int, input().split())

    if t == 0:

        bit.add(u, v)

    else:

        print(bit.sum(u, v))



"""

import os

import sys

if sys.argv[-1] == 'ONLINE_JUDGE':

    open('solve.pyx', 'w').write(code)

    os.system('cythonize -i -3 -b solve.pyx')

import solve
import sys

input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)


class BinaryIndexTree:  # 1-indexed
    def __init__(self, N):
        """
        INPUT
        N [int] -> 全部0で初期化
        N [list] -> そのまま初期化
        """
        if isinstance(N, int):
            self.N = N
            self.depth = N.bit_length()
            self.tree = [0] * (N + 1)
            self.elem = [0] * (N + 1)
        elif isinstance(N, list):
            self.N = len(N)
            self.depth = self.N.bit_length()
            self.tree = [0] + N
            self.elem = [0] + N
            self._init()
        else:
            raise "INVALID INPUT: input must be int or list"

    def _init(self):
        size = self.N
        for i in range(1, self.N):
            if i + (i & -i) > size:
                continue
            self.tree[i + (i & -i)] += self.tree[i]

    def show(self):
        print((*self.elem))

    def add(self, i, x):
        self.elem[i] += x
        while i <= self.N:
            self.tree[i] += x
            i += i & -i

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

    def lower_bound(self, val):
        if val <= 0:
            return 0
        i = 0
        k = 1 << self.depth
        while k:
            if i + k <= self.N and self.tree[i + k] < val:
                val -= self.tree[i + k]
                i += k
            k >>= 1
        return i + 1


N, Q = list(map(int, input().split()))
A = list(map(int, input().split()))
bit = BinaryIndexTree(A)
for _ in range(Q):
    t, a, b = list(map(int, input().split()))
    if t == 0:
        bit.add(a + 1, b)
    else:
        print((bit.sum(b) - bit.sum(a)))

code = r"""
# distutils: language=c++
# distutils: include_dirs = [/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
from libcpp cimport *
cdef extern from "/opt/atcoder-stl/atcoder/fenwicktree.hpp" namespace "atcoder":
    cdef cppclass fenwick_tree[T]:
        fenwick_tree()
        fenwick_tree(int n)
        void add(int a, T x)
        T sum(int l, int r)
import sys
input = sys.stdin.buffer.readline
N, Q = map(int, input().split())
cdef fenwick_tree[long] bit 
bit = fenwick_tree[long](N)
A = list(map(int, input().split()))
for i, a in enumerate(A):
    bit.add(i, a)
for _ in range(Q):
    t, u, v = map(int, input().split())
    if t == 0:
        bit.add(u, v)
    else:
        print(bit.sum(u, v))
"""
import os
import sys

if sys.argv[-1] == "ONLINE_JUDGE":
    open("solve.pyx", "w").write(code)
    os.system("cythonize -i -3 -b solve.pyx")
import solve

+code = r""" +# distutils: language=c++ +# distutils: include_dirs = [/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl] +from libcpp cimport * +cdef extern from "/opt/atcoder-stl/atcoder/fenwicktree.hpp" namespace "atcoder": +    cdef cppclass fenwick_tree[T]: +        fenwick_tree() +        fenwick_tree(int n) +        void add(int a, T x) +        T sum(int l, int r) +import sys +input = sys.stdin.buffer.readline +N, Q = map(int, input().split()) +cdef fenwick_tree[long] bit +bit = fenwick_tree[long](N) +A = list(map(int, input().split())) +for i, a in enumerate(A): +    bit.add(i, a) +for _ in range(Q): +    t, u, v = map(int, input().split()) +    if t == 0: +        bit.add(u, v) +    else: +        print(bit.sum(u, v)) +""" +import os -input = sys.stdin.buffer.readline -sys.setrecursionlimit(10**7) - - -class BinaryIndexTree:  # 1-indexed -    def __init__(self, N): -        """ -        INPUT -        N [int] -> 全部0で初期化 -        N [list] -> そのまま初期化 -        """ -        if isinstance(N, int): -            self.N = N -            self.depth = N.bit_length() -            self.tree = [0] * (N + 1) -            self.elem = [0] * (N + 1) -        elif isinstance(N, list): -            self.N = len(N) -            self.depth = self.N.bit_length() -            self.tree = [0] + N -            self.elem = [0] + N -            self._init() -        else: -            raise "INVALID INPUT: input must be int or list" - -    def _init(self): -        size = self.N -        for i in range(1, self.N): -            if i + (i & -i) > size: -                continue -            self.tree[i + (i & -i)] += self.tree[i] - -    def show(self): -        print((*self.elem)) - -    def add(self, i, x): -        self.elem[i] += x -        while i <= self.N: -            self.tree[i] += x -            i += i & -i - -    def sum(self, i): -        res = 0 -        while i > 0: -            res += self.tree[i] -            i -= i & -i -        return res - -    def lower_bound(self, val): -        if val <= 0: -            return 0 -        i = 0 -        k = 1 << self.depth -        while k: -            if i + k <= self.N and self.tree[i + k] < val: -                val -= self.tree[i + k] -                i += k -            k >>= 1 -        return i + 1 - - -N, Q = list(map(int, input().split())) -A = list(map(int, input().split())) -bit = BinaryIndexTree(A) -for _ in range(Q): -    t, a, b = list(map(int, input().split())) -    if t == 0: -        bit.add(a + 1, b) -    else: -        print((bit.sum(b) - bit.sum(a))) +if sys.argv[-1] == "ONLINE_JUDGE": +    open("solve.pyx", "w").write(code) +    os.system("cythonize -i -3 -b solve.pyx") +import solve