#include <bits/stdc++.h>
using namespace std;
long long tree[100002] = {0};
long long findcf(long long ind) {
  long long sum = 0;
  while (ind > 0) {
    sum += tree[ind];
    ind -= (ind & (-ind));
  }
  return sum;
}
void update(long long ind, long long val) {
  while (ind <= 100000) {
    tree[ind] += val;
    ind += (ind & (-ind));
  }
}
void incFreqFromTo(long long a, long long b, long long delta) {
  update(a, delta);
  update(b + 1, -delta);
}
long long getFreqAt(long long index) { return findcf(index); }
int main() {
  ios::sync_with_stdio(false);
  long long t, i, j, n, m, x;
  cin >> n >> m;
  for (i = 1; i <= n; ++i) {
    cin >> t;
    incFreqFromTo(i, i, t);
  }
  for (i = 0; i < m; ++i) {
    cin >> t;
    if (t == 1) {
      cin >> j >> x;
      incFreqFromTo(j, j, x - getFreqAt(j));
    } else if (t == 2) {
      cin >> x;
      incFreqFromTo(1, n, x);
    } else {
      cin >> j;
      cout << getFreqAt(j) << "\n";
    }
  }
  return 0;
}
