#include <bits/stdc++.h>
const int MAXN = 100010;
int flag[MAXN << 2];
int a[MAXN << 2];
int add;
int N, Q;
void PushDown(int rt) {
  int lc = rt << 1;
  int rc = rt << 1 | 1;
  if (flag[rt]) {
    flag[lc] += flag[rt];
    flag[rc] += flag[rt];
    flag[rt] = 0;
  }
  return;
}
void build(int l, int r, int rt) {
  flag[rt] = 0;
  if (l == r) {
    scanf("%d", &a[rt]);
    return;
  }
  int m = (l + r) >> 1;
  build(l, m, rt << 1);
  build(m + 1, r, rt << 1 | 1);
  return;
}
void Update(int x, int c, int l, int r, int rt) {
  if (l == x && r == x) {
    flag[rt] = 0;
    a[rt] = c;
    return;
  }
  PushDown(rt);
  int m = (l + r) >> 1;
  if (x <= m)
    Update(x, c, l, m, rt << 1);
  else
    Update(x, c, m + 1, r, rt << 1 | 1);
  return;
}
int Query(int x, int l, int r, int rt) {
  if (l == x && r == x) {
    return a[rt] + flag[rt];
  }
  PushDown(rt);
  int m = (l + r) >> 1;
  if (x <= m)
    return Query(x, l, m, rt << 1);
  else
    return Query(x, m + 1, r, rt << 1 | 1);
}
int main() {
  while (~scanf("%d%d", &N, &Q)) {
    build(1, N, 1);
    while (Q--) {
      int op, v, x;
      scanf("%d", &op);
      switch (op) {
        case 1:
          scanf("%d%d", &v, &x);
          Update(v, x, 1, N, 1);
          break;
        case 2:
          scanf("%d", &v);
          flag[1] += v;
          break;
        case 3:
          scanf("%d", &v);
          printf("%d\n", Query(v, 1, N, 1));
          break;
      }
    }
  }
  return 0;
}
