#include <bits/stdc++.h>
using namespace std;
const int M = 100005;
int n, m;
long long a[M], add;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= m; i++) {
    int op, x;
    scanf("%d%d", &op, &x);
    if (op == 1) {
      int y;
      scanf("%d", &y);
      a[x] = y - add;
    } else if (op == 2)
      add += x;
    else
      printf("%lld\n", a[x] + add);
  }
  return 0;
}
