# test

class fenwick_tree:

  def __init__(s, n):

    s._n = n

    s.data = [0] * n



  def add(s, p, x):

    p += 1

    while p <= s._n:

      s.data[p - 1] += x

      p += p & -p



  def sumlr(s, l, r):

    return s.sum(r) - s.sum(l)



  def sum(self, r):

    s = 0

    while r > 0:

      s += self.data[r - 1]

      r -= r & -r

    return s





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

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

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

  

bit = fenwick_tree(N)

for i in range(N):

  bit.add(i, a[i])



for q in Query:

  if q[0] == 0:

    _, p, x = q

    bit.add(p, x)

  else:

    _, l, r = q

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

class BIT:

  def __init__(s, n):

    s._n = n

    s.data = [0] * n

  def add(s, p, x):

    p += 1

    while p <= s._n:

      s.data[p - 1] += x

      p += p & -p

  def sum(s, l, r):

    return s.zum(r) - s.zum(l)

  def zum(s, r):

    ans = 0

    while r > 0:

      ans += s.data[r - 1]

      r -= r & -r

    return ans



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

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

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

  

bit = BIT(N)

for i in range(N):

  bit.add(i, a[i])

 

for q in Query:

  if q[0] == 0:

    _, p, x = q

    bit.add(p, x)

  else:

    _, l, r = q

    print((bit.sum(l, r)))
# test
class fenwick_tree:
    def __init__(s, n):
        s._n = n
        s.data = [0] * n

    def add(s, p, x):
        p += 1
        while p <= s._n:
            s.data[p - 1] += x
            p += p & -p

    def sumlr(s, l, r):
        return s.sum(r) - s.sum(l)

    def sum(self, r):
        s = 0
        while r > 0:
            s += self.data[r - 1]
            r -= r & -r
        return s


N, Q = list(map(int, input().split()))
a = list(map(int, input().split()))
Query = [list(map(int, input().split())) for _ in range(Q)]
bit = fenwick_tree(N)
for i in range(N):
    bit.add(i, a[i])
for q in Query:
    if q[0] == 0:
        _, p, x = q
        bit.add(p, x)
    else:
        _, l, r = q
        print((bit.sumlr(l, r)))

class BIT:
    def __init__(s, n):
        s._n = n
        s.data = [0] * n

    def add(s, p, x):
        p += 1
        while p <= s._n:
            s.data[p - 1] += x
            p += p & -p

    def sum(s, l, r):
        return s.zum(r) - s.zum(l)

    def zum(s, r):
        ans = 0
        while r > 0:
            ans += s.data[r - 1]
            r -= r & -r
        return ans


N, Q = list(map(int, input().split()))
a = list(map(int, input().split()))
Query = [list(map(int, input().split())) for _ in range(Q)]
bit = BIT(N)
for i in range(N):
    bit.add(i, a[i])
for q in Query:
    if q[0] == 0:
        _, p, x = q
        bit.add(p, x)
    else:
        _, l, r = q
        print((bit.sum(l, r)))

-# test -class fenwick_tree: +class BIT: -    def sumlr(s, l, r): -        return s.sum(r) - s.sum(l) +    def sum(s, l, r): +        return s.zum(r) - s.zum(l) -    def sum(self, r): -        s = 0 +    def zum(s, r): +        ans = 0 -            s += self.data[r - 1] +            ans += s.data[r - 1] -        return s +        return ans -bit = fenwick_tree(N) +bit = BIT(N) -        print((bit.sumlr(l, r))) +        print((bit.sum(l, r)))