def segfunc(x,y):return x+y

ide_ele=0

class segtree():

  def __init__(self,init_val,segfunc=segfunc,ide_ele=ide_ele):

    n=len(init_val)

    self.segfunc=segfunc

    self.ide_ele=ide_ele

    self.num=1<<(n-1).bit_length()

    self.tree=[ide_ele]*2*self.num

    for i in range(n):

      self.tree[self.num+i]=init_val[i]

    for i in range(self.num-1,0,-1):

      self.tree[i]=self.segfunc(self.tree[2*i], self.tree[2*i+1])

  def update(self,k,x):

    k+=self.num

    self.tree[k]+=x

    while k>1:

      self.tree[k>>1]=self.segfunc(self.tree[k],self.tree[k^1])

      k>>=1

  def query(self,l,r):

    res=self.ide_ele

    l+=self.num

    r+=self.num+1

    while l<r:

      if l&1:

        res=self.segfunc(res,self.tree[l])

        l+=1

      if r&1:

        res=self.segfunc(res,self.tree[r-1])

      l>>=1

      r>>=1

    return res

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

st=segtree(list(map(int,input().split())))

ans=[]

for _ in range(q):

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

  if x:ans+=[st.query(y,z-1)]

  else:st.update(y,z)

print(*ans,sep='\n')

class binaryindexedtree():

  def __init__(self,n):

    self.n=n

    self.tree=[0]*n

  def add(self,a,w):

    x=a

    while x<=self.n:

      self.tree[x-1]+=w

      x+=x&(-x)

  def sums(self,a):

    x=a

    S=0

    while x!=0:

      S+=self.tree[x-1]

      x-=x&(-x)

    return S

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

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

bit=binaryindexedtree(n)

for i,x in enumerate(a,1):

  bit.add(i,x)

ans=[]

for _ in range(q):

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

  if x:ans+=[bit.sums(z)-bit.sums(y)]

  else:bit.add(y+1,z)

print(*ans,sep='\n')

def segfunc(x, y):
    return x + y


ide_ele = 0


class segtree:
    def __init__(self, init_val, segfunc=segfunc, ide_ele=ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        k += self.num
        self.tree[k] += x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        res = self.ide_ele
        l += self.num
        r += self.num + 1
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res


n, q = map(int, input().split())
st = segtree(list(map(int, input().split())))
ans = []
for _ in range(q):
    x, y, z = map(int, input().split())
    if x:
        ans += [st.query(y, z - 1)]
    else:
        st.update(y, z)
print(*ans, sep="\n")

class binaryindexedtree:
    def __init__(self, n):
        self.n = n
        self.tree = [0] * n

    def add(self, a, w):
        x = a
        while x <= self.n:
            self.tree[x - 1] += w
            x += x & (-x)

    def sums(self, a):
        x = a
        S = 0
        while x != 0:
            S += self.tree[x - 1]
            x -= x & (-x)
        return S


n, q = map(int, input().split())
a = list(map(int, input().split()))
bit = binaryindexedtree(n)
for i, x in enumerate(a, 1):
    bit.add(i, x)
ans = []
for _ in range(q):
    x, y, z = map(int, input().split())
    if x:
        ans += [bit.sums(z) - bit.sums(y)]
    else:
        bit.add(y + 1, z)
print(*ans, sep="\n")

-def segfunc(x, y): -    return x + y +class binaryindexedtree: +    def __init__(self, n): +        self.n = n +        self.tree = [0] * n +    def add(self, a, w): +        x = a +        while x <= self.n: +            self.tree[x - 1] += w +            x += x & (-x) -ide_ele = 0 - - -class segtree: -    def __init__(self, init_val, segfunc=segfunc, ide_ele=ide_ele): -        n = len(init_val) -        self.segfunc = segfunc -        self.ide_ele = ide_ele -        self.num = 1 << (n - 1).bit_length() -        self.tree = [ide_ele] * 2 * self.num -        for i in range(n): -            self.tree[self.num + i] = init_val[i] -        for i in range(self.num - 1, 0, -1): -            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1]) - -    def update(self, k, x): -        k += self.num -        self.tree[k] += x -        while k > 1: -            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1]) -            k >>= 1 - -    def query(self, l, r): -        res = self.ide_ele -        l += self.num -        r += self.num + 1 -        while l < r: -            if l & 1: -                res = self.segfunc(res, self.tree[l]) -                l += 1 -            if r & 1: -                res = self.segfunc(res, self.tree[r - 1]) -            l >>= 1 -            r >>= 1 -        return res +    def sums(self, a): +        x = a +        S = 0 +        while x != 0: +            S += self.tree[x - 1] +            x -= x & (-x) +        return S -st = segtree(list(map(int, input().split()))) +a = list(map(int, input().split())) +bit = binaryindexedtree(n) +for i, x in enumerate(a, 1): +    bit.add(i, x) -        ans += [st.query(y, z - 1)] +        ans += [bit.sums(z) - bit.sums(y)] -        st.update(y, z) +        bit.add(y + 1, z)