#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int sumadd, a[N], b[N], n, m;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < m; ++i) {
    int t, x, y;
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d%d", &x, &y);
      a[x - 1] = y;
      b[x - 1] = sumadd;
    } else if (t == 2) {
      scanf("%d", &x);
      sumadd += x;
    } else {
      scanf("%d", &x);
      printf("%d\n", a[x - 1] + sumadd - b[x - 1]);
    }
  }
  return 0;
}
