#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[n + 1];
  for (int i = 1; i <= n; i++) cin >> arr[i];
  int c = 0;
  for (int i = 0; i < m; i++) {
    int ch;
    cin >> ch;
    if (ch == 1) {
      int y;
      int z;
      cin >> y >> z;
      arr[y] = z;
      arr[y] -= c;
    } else if (ch == 2) {
      int y;
      cin >> y;
      c += y;
    } else {
      int y;
      cin >> y;
      cout << arr[y] + c << endl;
    }
  }
}
