local band = bit.band
local FenwickTree = {}
FenwickTree.create = function(self, n)
  self.n = n
  self.v = {}
  for i = 1, n do self.v[i] = 0LL end
end
FenwickTree.add = function(self, pos, val)
  while pos <= self.n do
    self.v[pos] = self.v[pos] + val
    pos = pos + band(pos, -pos)
  end
end
FenwickTree.sum = function(self, r)
  local ret = 0
  while 0 < r do
    ret = ret + self.v[r]
    r = r - band(r, -r)
  end
  return ret
end
FenwickTree.new = function(n)
  local obj = {}
  setmetatable(obj, {__index = FenwickTree})
  obj:create(n)
  return obj
end

local n, q = io.read("*n", "*n")
local fw = FenwickTree.new(n)
for i = 1, n do
  local a = io.read("*n")
  fw:add(i, a)
end
for iq = 1, q do
  local a, b, c = io.read("*n", "*n", "*n")
  if a == 0 then
    fw:add(b + 1, c)
  else
    local ans = fw:sum(c)
    if 0 < b then ans = ans - fw:sum(b) end
    ans = tostring(ans):gsub("LL", "")
    print(ans)
  end
end
