import sys

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



class BIT:

  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=BIT(n)

for i in range(n):

  Bit.add(i,a[i])

for i 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 = sys.stdin.readline





class BIT():

    def __init__(self, n, data=None):

        self.n = n

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

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

        if data:

            self.build(data)



    def build(self, data):

        for i in range(self.n):

            self.bit[i + 1] = self.data[i + 1] = data[i]

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

            j = i + (i & (-i))

            if j <= self.n:

                self.bit[j] += self.bit[i]



    def add(self, idx, x):

        self.data[idx] += x

        while idx <= self.n:

            self.bit[idx] += x

            idx += (idx & (-idx))



    def sum(self, idx):

        s = 0

        while idx:

            s += self.bit[idx]

            idx -= (idx & (-idx))

        return s





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

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

bit=BIT(n,a)

for i in range(q):

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

    if t==0:

        bit.add(x+1,y)

    else:

        print((bit.sum(y)-bit.sum(x)))
import sys

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


class BIT:
    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 = BIT(n)
for i in range(n):
    Bit.add(i, a[i])
for i 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 = sys.stdin.readline


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

    def build(self, data):
        for i in range(self.n):
            self.bit[i + 1] = self.data[i + 1] = data[i]
        for i in range(1, self.n):
            j = i + (i & (-i))
            if j <= self.n:
                self.bit[j] += self.bit[i]

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

    def sum(self, idx):
        s = 0
        while idx:
            s += self.bit[idx]
            idx -= idx & (-idx)
        return s


n, q = list(map(int, input().split()))
a = list(map(int, input().split()))
bit = BIT(n, a)
for i in range(q):
    t, x, y = list(map(int, input().split()))
    if t == 0:
        bit.add(x + 1, y)
    else:
        print((bit.sum(y) - bit.sum(x)))

-input = lambda: sys.stdin.readline().rstrip() +input = sys.stdin.readline -    def __init__(self, n): -        self.bit = [0] * n +    def __init__(self, n, data=None): +        self.n = n +        self.bit = [0] * (self.n + 1) +        self.data = [0] * (self.n + 1) +        if data: +            self.build(data) -    def add(self, i, x): -        i += 1 -        while i <= len(self.bit): -            self.bit[i - 1] += x -            i += i & -i +    def build(self, data): +        for i in range(self.n): +            self.bit[i + 1] = self.data[i + 1] = data[i] +        for i in range(1, self.n): +            j = i + (i & (-i)) +            if j <= self.n: +                self.bit[j] += self.bit[i] -    def sum_sub(self, i): -        a = 0 -        i += 1 -        while i: -            a += self.bit[i - 1] -            i -= i & -i -        return a +    def add(self, idx, x): +        self.data[idx] += x +        while idx <= self.n: +            self.bit[idx] += x +            idx += idx & (-idx) -    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, idx): +        s = 0 +        while idx: +            s += self.bit[idx] +            idx -= idx & (-idx) +        return s -Bit = BIT(n) -for i in range(n): -    Bit.add(i, a[i]) +bit = BIT(n, a) -    t, a, b = list(map(int, input().split())) +    t, x, y = list(map(int, input().split())) -        Bit.add(a, b) +        bit.add(x + 1, y) -        print((Bit.sum(a, b))) +        print((bit.sum(y) - bit.sum(x)))