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