#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v, q;
  int n, m;
  cin >> n >> m;
  int a[100000 + 10];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int t, v1, x, y, q1[100000], change = 0;
  for (int i = 1; i <= m; i++) {
    cin >> t;
    if (t == 1) {
      cin >> v1 >> x;
      a[v1] = x - change;
    }
    if (t == 2) {
      cin >> y;
      change += y;
    }
    if (t == 3) {
      cin >> q1[i];
      cout << a[q1[i]] + change << endl;
    }
  }
  return 0;
}
