#include <bits/stdc++.h>
#define lowbit(x) x &(-x)
using namespace std;
int a[500005], c[500005], n, m;
int sum(int x)
{
int ans = 0;
while (x)
{
ans += c[m];
m -= lowbit(m);
}
return ans;
}
void update(int x, int val) // 给第 x 个节点增加 val
{
while (x <= n)
{
c[x] += val;
x += lowbit(x);
}
}
int main(void)
{
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
update(i, a[i]);
}
while (m--)
{
int x, y, k;
int opt;
scanf("%d", &opt);
if (opt == 1)
scanf("%d%d", &x, &k), update(x, k);
else if (opt == 2)
scanf("%d%d", &x, &y), printf("%d\n", sum(y) - sum(x - 1));
}
}
RT 不知道哪里错了