#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int a[100100], b[100100];
struct query {
  int t;
  int v, x, y, q;
};
query Q[100100];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  map<int, int> M;
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    cin >> Q[i].t;
    if (Q[i].t == 1) {
      cin >> Q[i].v >> Q[i].x;
      M[Q[i].v] = -cnt;
      a[Q[i].v] = Q[i].x;
    } else if (Q[i].t == 2) {
      cin >> Q[i].y;
      cnt += Q[i].y;
    } else if (Q[i].t == 3) {
      cin >> Q[i].q;
      int add = M[Q[i].q];
      cout << cnt + add + a[Q[i].q] << "\n";
    }
  }
  return 0;
}
