#include <fstream>
using namespace std;
ifstream in("aib.in");
ofstream out("aib.out");
int n, m;
unsigned int arb[1 << 18];
void actualizare(int nod, int st, int dr, int poz, int val)
{
if(poz <= st && dr <= poz)
{
arb[nod] += val;
return;
}
int mij = (st + dr) >> 1;
if(poz <= mij)
actualizare(nod << 1, st, mij, poz, val);
if(mij + 1 <= poz)
actualizare((nod << 1) + 1, mij + 1, dr, poz, val);
arb[nod] = arb[nod << 1] + arb[(nod << 1) + 1];
}
int interogare(int nod, int st, int dr, int x, int y)
{
if(x <= st && dr <= y)
return arb[nod];
int mij = (st + dr) >> 1;
unsigned int rez = 0;
if(x <= mij)
rez += interogare(nod << 1, st, mij, x, y);
if(mij + 1 <= y)
rez += interogare((nod << 1) + 1, mij + 1, dr, x, y);
return rez;
}
void citire()
{
in >> n >> m;
for(int i = 1; i <= n; i++)
{
int x;
in >> x;
actualizare(1, 1, n, i, x);
}
}
int main()
{
citire();
for(int i = 1; i <= m; i++)
{
int tip;
in >> tip;
if(tip == 2)
{
int a;
in >> a;
int j = 0, pas = 1 << 17;
while(pas)
{
if(interogare(1, 1, n, 1, j + pas) < a)
j += pas;
pas /= 2;
}
out << j + 1 << '\n';
}
else
{
int a, b;
in >> a >> b;
if(tip == 0)
actualizare(1, 1, n, a, b);
else
out << interogare(1, 1, n, a, b) << '\n';
}
}
return 0;
}