#include <bits/stdc++.h>
using namespace std;
long long a[1000002];
map<int, int> mp;
int main() {
  long long n, m, i, x, y, z, s = 0;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
  }
  for (i = 1; i <= m; i++) {
    scanf("%I64d", &x);
    if (x == 3) {
      scanf("%I64d", &y);
      if (mp.count(y))
        cout << a[y] - mp[y] + s << "\n";
      else
        cout << a[y] + s << "\n";
    }
    if (x == 2) {
      scanf("%I64d", &y);
      s = s + y;
    }
    if (x == 1) {
      scanf("%I64d %I64d", &y, &z);
      a[y] = z;
      mp[y] = s;
    }
  }
  return 0;
}
