#include <bits/stdc++.h>
using namespace std;
int unamount[100010];
int main() {
  int n, m, a[100010];
  scanf("%d", &n);
  scanf("%d", &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int t, v, x, y, q, amount = 0;
  for (int i = 0; i < m; i++) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &v);
      scanf("%d", &x);
      a[v - 1] = x;
      unamount[v - 1] = amount;
    } else if (t == 2) {
      scanf("%d", &y);
      amount += y;
    } else {
      scanf("%d", &q);
      printf("%d\n", a[q - 1] + amount - unamount[q - 1]);
    }
  }
}
