#include <bits/stdc++.h>
using namespace std;
long long ar[100002], sum[100002];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> ar[i];
  long long cnt = 0;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      int y;
      long long z;
      cin >> y >> z;
      ar[y - 1] = z;
      sum[y - 1] = cnt;
    }
    if (x == 2) {
      int y;
      cin >> y;
      cnt += y;
    }
    if (x == 3) {
      int y;
      cin >> y;
      cout << abs(ar[y - 1] + cnt - sum[y - 1]) << endl;
    }
  }
}
