import sys

input = lambda: sys.stdin.readline().rstrip()



# BinaryIndexedTree

# O(logN)で累積和取得と値の更新

# add(i,x)...i番目にxを加算

# sum(i,j)...[i,j)の累積和を取得

class BinaryIndexedTree:

  def __init__(self, n):

    self.bit = [0] * n



  def add(self, i, x):

    i += 1

    while i <= len(self.bit):

      self.bit[i-1] += x

      i += i & -i



  def sum_sub(self, i):

    a = 0

    i += 1

    while i:

      a += self.bit[i-1]

      i -= i & -i

    return a



  def sum(self, i, j):

    a = 0

    if j != 0:

      a += self.sum_sub(j-1)

    if i != 0:

      a -= self.sum_sub(i-1)

    return a



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

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

Bit=BinaryIndexedTree(n)

for i in range(n):Bit.add(i,a[i])

for _ in range(q):

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

  if t==0:

    Bit.add(a,b)

  else:

    print((Bit.sum(a,b)))
import sys

input = lambda: sys.stdin.readline().rstrip()



# UnionFind

class FenwickTree:

  def __init__(self,n):

    self.n=n

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

  def add(self,i,x):

    i+=1

    while i<=n:

      self.bit[i]+=x

      i+=i&-i

  def sumsub(self,r):

    ans=0

    while r:

      ans+=self.bit[r]

      r-=r&-r

    return ans

  def sum(self,l,r):

    ans=self.sumsub(r)

    if l!=0:ans-=self.sumsub(l)

    return ans



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

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

ft=FenwickTree(n)

for i in range(n):ft.add(i,a[i])

for _ in range(q):

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

  if t==0:

    ft.add(a,b)

  else:

    print((ft.sum(a,b)))
import sys

input = lambda: sys.stdin.readline().rstrip()
# BinaryIndexedTree
# O(logN)で累積和取得と値の更新
# add(i,x)...i番目にxを加算
# sum(i,j)...[i,j)の累積和を取得
class BinaryIndexedTree:
    def __init__(self, n):
        self.bit = [0] * n

    def add(self, i, x):
        i += 1
        while i <= len(self.bit):
            self.bit[i - 1] += x
            i += i & -i

    def sum_sub(self, i):
        a = 0
        i += 1
        while i:
            a += self.bit[i - 1]
            i -= i & -i
        return a

    def sum(self, i, j):
        a = 0
        if j != 0:
            a += self.sum_sub(j - 1)
        if i != 0:
            a -= self.sum_sub(i - 1)
        return a


n, q = list(map(int, input().split()))
a = list(map(int, input().split()))
Bit = BinaryIndexedTree(n)
for i in range(n):
    Bit.add(i, a[i])
for _ in range(q):
    t, a, b = list(map(int, input().split()))
    if t == 0:
        Bit.add(a, b)
    else:
        print((Bit.sum(a, b)))

import sys

input = lambda: sys.stdin.readline().rstrip()
# UnionFind
class FenwickTree:
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n + 1)

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

    def sumsub(self, r):
        ans = 0
        while r:
            ans += self.bit[r]
            r -= r & -r
        return ans

    def sum(self, l, r):
        ans = self.sumsub(r)
        if l != 0:
            ans -= self.sumsub(l)
        return ans


n, q = list(map(int, input().split()))
a = list(map(int, input().split()))
ft = FenwickTree(n)
for i in range(n):
    ft.add(i, a[i])
for _ in range(q):
    t, a, b = list(map(int, input().split()))
    if t == 0:
        ft.add(a, b)
    else:
        print((ft.sum(a, b)))

-# BinaryIndexedTree -# O(logN)で累積和取得と値の更新 -# add(i,x)...i番目にxを加算 -# sum(i,j)...[i,j)の累積和を取得 -class BinaryIndexedTree: +# UnionFind +class FenwickTree: -        self.bit = [0] * n +        self.n = n +        self.bit = [0] * (n + 1) -        while i <= len(self.bit): -            self.bit[i - 1] += x +        while i <= n: +            self.bit[i] += x -    def sum_sub(self, i): -        a = 0 -        i += 1 -        while i: -            a += self.bit[i - 1] -            i -= i & -i -        return a +    def sumsub(self, r): +        ans = 0 +        while r: +            ans += self.bit[r] +            r -= r & -r +        return ans -    def sum(self, i, j): -        a = 0 -        if j != 0: -            a += self.sum_sub(j - 1) -        if i != 0: -            a -= self.sum_sub(i - 1) -        return a +    def sum(self, l, r): +        ans = self.sumsub(r) +        if l != 0: +            ans -= self.sumsub(l) +        return ans -Bit = BinaryIndexedTree(n) +ft = FenwickTree(n) -    Bit.add(i, a[i]) +    ft.add(i, a[i]) -        Bit.add(a, b) +        ft.add(a, b) -        print((Bit.sum(a, b))) +        print((ft.sum(a, b)))