#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, int> > arr;
  int n, m, num, c = 0, x, y;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &num);
    arr.push_back(pair<int, int>(num, 0));
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &num);
    if (num == 1) {
      scanf("%d %d", &x, &y);
      arr[x - 1].first = y;
      arr[x - 1].second = c;
    } else if (num == 2) {
      scanf("%d", &x);
      c += x;
    } else if (num == 3) {
      scanf("%d", &x);
      printf("%d\n", arr[x - 1].first + (c - arr[x - 1].second));
    }
  }
  return 0;
}
