#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:100000000")
int mas[100100];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &mas[i]);
  int add = 0;
  for (int i = 0; i < m; i++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int v, x;
      scanf("%d %d", &v, &x);
      mas[v - 1] = x - add;
    } else if (t == 2) {
      int y;
      scanf("%d", &y);
      add += y;
    } else {
      int q;
      scanf("%d", &q);
      printf("%d\n", mas[q - 1] + add);
    }
  }
  return 0;
}
