#include<fstream>
using namespace std;
int a[15001],i,j,k,m,n,u,x,y;
void update(int poz, int u)
{
while (poz<=n)
{
a[poz]-=u;
poz+=(poz&(-poz));
}
}
int suma (int poz)
{
int sol=0;
while (poz>=1)
{
sol+=a[poz];
poz-=(poz&(-poz));
}
return sol;
}
int main()
{
ifstream cin("datorii.in");
ofstream cout("datorii.out");
cin>>n>>m;
for (i=1; i<=n; ++i)
{
cin>>x;
update(i,-x);
}
for (i=1; i<=m; ++i)
{
cin>>k;
if (!k) {
cin>>x>>y;
update(x,y);
}
if (k)
{
cin>>x>>y;
cout<<suma(y)-suma(x-1)<<"\n";
}
}
return 0;
}