n,m=map(int,input().split())
a=list(map(int,input().split()))
B=317
st1=[(0,i) for i in range(B*B)]
for i in range(m):
  st1[i]=(a[i],i)
st2=[max(st1[i*B:i*B+B]) for i in range(B)]
q=int(input())
for _ in range(q):
  t,x,y=map(int,input().split())
  x-=1
  if t==1:
    st1[x]=(st1[x][0]+y,x)
    i=x//B
    st2[i]=max(st1[i*B:i*B+B])
  if t==2:
    st1[x]=(st1[x][0]-y,x)
    i=x//B
    st2[i]=max(st1[i*B:i*B+B])
  if t==3:
    print(max(st2)[1]+1)