#include <bits/stdc++.h>
int n, m;
int ori[100010];
int mod[100010];
int dec[100010];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", ori + i);
  int sumup = 0;
  for (int i = 0; i != m; i++) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      int v, x;
      scanf("%d%d", &v, &x);
      mod[v] = x;
      dec[v] = sumup;
    } else if (type == 2) {
      int y;
      scanf("%d", &y);
      sumup += y;
    } else {
      int x;
      scanf("%d", &x);
      if (mod[x]) {
        printf("%d\n", mod[x] - dec[x] + sumup);
      } else {
        printf("%d\n", ori[x] + sumup);
      }
    }
  }
  return 0;
}
