#include <bits/stdc++.h>
using namespace std;
double pi = acos(-1.0);
int a[100005], mark[100005];
int main() {
  int n, m, t, x, v, add = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &t, &x);
    if (t == 1) {
      scanf("%d", &v);
      a[x] = v;
      mark[x] = -add;
    } else if (t == 2) {
      add += x;
    } else {
      printf("%d\n", a[x] + mark[x] + add);
    }
  }
  return 0;
}
