all=[0]*2000100 sz2=[0]*2000100 def psup(rt): all[rt]=all[rt*2]+all[rt*2+1] def bud(l,r,rt): if l==r: all[rt]=sz2[l-1] else: mid=(l+r)//2 bud(l,mid,rt*2) bud(mid+1,r,rt*2+1) psup(rt) def upd(p,k,l,r,rt): all[rt]+=k if l!=r: mid=(l+r)//2 if p<=mid: upd(p,k,l,mid,rt*2) else: upd(p,k,mid+1,r,rt*2+1) psup(rt) def que(ll,rr,l,r,rt): if ll<=l and r<=rr: return all[rt] else: mid=(l+r)//2 ret=0 if ll<=mid: ret+=que(ll,rr,l,mid,rt*2) if mid < rr: ret+=que(ll,rr,mid+1,r,rt*2+1) return ret sz1=[int(x) for x in input().strip().split(" ")] n=sz1[0] m=sz1[1] sz2=[int(x) for x in input().strip().split(" ")] bud(1,n,1) for i in range(m): xxx=[int(x) for x in input().strip().split(" ")] op=xxx[0] if op==1: upd(xxx[1],xxx[2],1,n,1) else: res=que(xxx[1],xxx[2],1,n,1) print(res)