#include <bits/stdc++.h>
// #define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
const int N = 1e6 + 10;
long long a[N], c[N];
int n, q;
int lowbit(int x) // 返回末尾的1
{
return x & -x;
}
void add(int x, int y)
{
for (int i = x; i < N; i += lowbit(i))
{
c[i] += y;
}
}
long long query(int x)
{
long long sum = 0;
for (int i = x; i; i -= lowbit(i))
{
sum += c[i];
}
return sum;
}
signed main()
{
// IOS;
scanf("%d%d", &n, &q);
for (int i = 1; i <= n; i ++ )
{
int x;
scanf("%d", &x);
add(i, x);
}
while (q -- )
{
int op;
scanf("%d", &op);
if (op == 1)
{
int i, x;
scanf("%d%d", &i, &x);
add(i, x);
}
else
{
int l, r;
scanf("%d%d", &l, &r);
printf("%lld\n", query(r) - query(l - 1));
}
}
return 0;
}