// luogu-judger-enable-o2
#include<iostream>
using namespace std;
inline void read(long long &k)
{
long long x=0,f=1;
char c=getchar();
while(c<'0'||c>'9')
{
if(c=='-')
{
f=-1;
}
c=getchar();
}
while(c>='0'&&c<='9')
{
x=x*10+c-'0';
c=getchar();
}
k=x*f;
}
int main()
{
long long n,m;
read(n);
read(m);
long long sz[n];
for(long long k=0;k<n;k++)
{
read(sz[k]);
}
long long a,b,c;
for(long long k=1;k<=m;k++)
{
read(a);
read(b);
read(c);
if(a==1)
{
sz[b-1]+=c;
}
else if(a==2)
{
long long ans=0;
for(long long k=b-1;k<c;k++)
{
ans+=sz[k];
}
cout<<ans<<endl;
}
}
}