import java.io.*; import java.util.*; class Main { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); String s[]=bu.readLine().split(" "); int m=Integer.parseInt(s[1]); a=new long[m+1]; st=new int[4*(m+1)]; long n=Long.parseLong(s[0]); int i; s=bu.readLine().split(" "); for(i=1;i<=m;i++) { a[i]=Long.parseLong(s[i-1]); update(0,m,i,0); } int q=Integer.parseInt(bu.readLine()); while(q-->0) { s=bu.readLine().split(" "); int t=Integer.parseInt(s[0]),x=Integer.parseInt(s[1]); long y=Long.parseLong(s[2]); if(t==1) { a[x]+=y; update(0,m,x,0); } else if(t==2) { a[x]-=y; a[x]=Math.max(a[x],0); //dunno if its needed or not(cant read japanese) update(0,m,x,0); } else sb.append(query(0,m,0,m,0)+"\n"); } System.out.print(sb); } static int st[]; static long a[]; static void update(int ss,int se,int i,int n) { if(ss>se) return; if(ss==se) { st[n]=i; return; } int m=(ss+se)>>1; if(i<=m) update(ss,m,i,2*n+1); else update(m+1,se,i,2*n+2); if(a[st[2*n+1]]>a[st[2*n+2]]) st[n]=st[2*n+1]; else st[n]=st[2*n+2]; } static int query(int ss,int se,int qs,int qe,int n) { if(ss>se || qs>se || qe=se) return st[n]; int m=(ss+se)>>1; int q1=query(ss,m,qs,qe,2*n+1),q2=query(m+1,se,qs,qe,2*n+2); if(a[q2]>=a[q1]) return q2; else return q1; } }