#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<map>
#define mem(a,b) memset(a,b,sizeof(a))
#define INF 0x3fffffff
#define ll long long
using namespace std;
inline int read()
{
char ch=getchar();int x=0,cf=1;
while(ch<'0'||ch>'9'){if(ch=='-')cf=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
return x*cf;
}
int n,m,xx,yy,z,a;
int tree[505550];
int lowbit(int x)
{
return x&(-x);
}
int find(int x)
{
int ans=0;
for(;x>0;x-=lowbit(x))
{
ans+=tree[x];
}
return ans;
}
int secfind(int x,int y)
{
return find(y)-find(x-1);
}
void update(int x,int k)
{
for(;x<=n;x+=lowbit(x))
{
tree[x]+=k;
}
}
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>a;
tree[i]=i;
}
for(int i=1;i<=m;i++)
{
cin>>z>>xx>>yy;
if(z==1)
{
update(xx,yy);
}
if(z==2)
{
cout<<secfind(xx,yy)<<endl;
}
}
return 0;
}