#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
int a[MAXN];
int main() {
  int n, m, t, x, v, y, q, sum = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> t;
    if (t == 1) {
      cin >> v >> x;
      a[v - 1] = x - sum;
    } else if (t == 2) {
      cin >> y;
      sum += y;
    } else {
      cin >> q;
      cout << a[q - 1] + sum << '\n';
    }
  }
}
