#include <bits/stdc++.h>
using namespace std;
const int MX = 100009;
int arr[MX];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", arr + i);
  int add = 0;
  for (int i = 0; i < m; ++i) {
    int cmd;
    scanf("%d", &cmd);
    if (cmd == 1) {
      int idx, val;
      scanf("%d%d", &idx, &val);
      --idx;
      arr[idx] = val - add;
    } else if (cmd == 2) {
      int val;
      scanf("%d", &val);
      add += val;
    } else {
      int idx;
      scanf("%d", &idx);
      --idx;
      printf("%d\n", arr[idx] + add);
    }
  }
  return 0;
}
