#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int total = 0;
  while (m--) {
    int t;
    cin >> t;
    if (t == 1) {
      int i, v;
      cin >> i >> v;
      i--;
      arr[i] = v;
      arr[i] -= total;
    } else if (t == 2) {
      int no;
      cin >> no;
      total += no;
    } else {
      int out;
      cin >> out;
      out--;
      cout << arr[out] + total << endl;
    }
  }
}
