#include <bits/stdc++.h>
#define int __int128
using namespace std;
inline int read(){
int s = 0, w = 1; char ch = getchar();
while(ch < '0' || ch > '9'){ if(ch == '-') w = -1; ch = getchar();}
while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
return s * w;
}
inline void print(int x){
if(x<0) putchar('-'),x=-x;
if(x>9) print(x/10);
putchar(char(x%10+'0'));
}
int n, m;
int d[500001];
int a[500001];
int o[500001];
int egg;
int z;
int q, w, e, r;
int lowbit(int x) {
return x&(-x);
}
void add(int x, int y) {
while (x <= n) {
a[x] += y;
x += lowbit(x);
}
}
int ask(int x) {
egg = 0;
while (x > 0) {
egg += a[x];
x -= lowbit(x);
}
return egg;
}
signed main() {
n=read(),m=read();
for (int i = 1; i <= n; i++) {
o[i]=read();
d[i] += o[i];
d[i + 1] -= o[i];
}
for (int i = 1; i <= n; i++)
add(i, d[i]) ;
for (int i = 1; i <= m; i++) {
z=read();
if (z == 2) {
q=read();
print(ask(q));
printf("\n");
}
if (z == 1) {
w=read();
e=read();
r=read();
add(w, r);
add(e + 1, -r);
}
}
return 0;
}