#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define D1 ((D+1)%3)
#define D2 ((D+2)%3)
#define rep for(int i=0;i<=2;i++)
using namespace std;
const int maxn=100010;
struct kd
{
int v[3],sm[3],sn[3],siz,ls,rs;
kd (){}
int & operator [] (int x) {return v[x];}
kd (int a,int b,int c) {v[0]=sm[0]=sn[0]=a,v[1]=sm[1]=sn[1]=b,v[2]=sm[2]=sn[2]=c,siz=1,ls=rs=0;}
};
kd t[maxn];
int n,m,D,tot,ans,root,cnt;
int qx[maxn],qk[maxn],X[maxn],Y[maxn],Z[maxn],head[maxn],rm[3],rn[3];
bool cmp(kd a,kd b)
{
return (a[D]==b[D])?((a[D1]==b[D1])?(a[D2]<b[D2]):(a[D1]<b[D1])):(a[D]<b[D]);
}
int rd()
{
int ret=0,f=1; char gc=getchar();
while(gc<‘0‘||gc>‘9‘) {if(gc==‘-‘)f=-f; gc=getchar();}
while(gc>=‘0‘&&gc<=‘9‘) ret=ret*10+gc-‘0‘,gc=getchar();
return ret*f;
}
void pushup(int x,int y)
{
t[x].siz+=t[y].siz;
rep t[x].sm[i]=max(t[x].sm[i],t[y].sm[i]),t[x].sn[i]=min(t[x].sn[i],t[y].sn[i]);
}
int build(int l,int r,int d)
{
if(l>r) return 0;
D=d;
int mid=l+r>>1;
nth_element(t+l,t+mid,t+r+1,cmp);
t[mid].ls=build(l,mid-1,(d+1)%3),t[mid].rs=build(mid+1,r,(d+1)%3);
if(t[mid].ls) pushup(mid,t[mid].ls);
if(t[mid].rs) pushup(mid,t[mid].rs);
return mid;
}
int getmin(int x)
{
int ret=0;
rep ret|=(t[x].sm[i]<rn[i]||t[x].sn[i]>rm[i]);
return !ret;
}
int getmax(int x)
{
int ret=1;
rep ret&=(t[x].sm[i]<=rm[i]&&t[x].sn[i]>=rn[i]);
return ret;
}
int check(int x)
{
int ret=1;
rep ret&=(t[x].v[i]<=rm[i]&&t[x].v[i]>=rn[i]);
return ret;
}
void query(int x)
{
if(!x||!getmin(x)) return ;
if(getmax(x))
{
ans+=t[x].siz;
return ;
}
if(check(x)) ans++;
query(t[x].ls),query(t[x].rs);
}
char str[10];
int main()
{
n=rd(),m=rd();
int i,a,b;
for(i=1;i<=n;i++) a=i,b=rd(),X[i]=a+b,Y[i]=b-a,Z[i]=0,head[i]=i;
for(tot=n,i=1;i<=m;i++)
{
scanf("%s",str);
if(str[0]==‘M‘) a=rd(),b=rd(),X[++tot]=a+b,Y[tot]=b-a,Z[tot]=i,head[a]=tot;
else qx[i]=head[rd()],qk[i]=rd();
}
for(i=1;i<=tot;i++) t[i]=kd(X[i],Y[i],Z[i]);
root=build(1,tot,0);
for(i=1;i<=m;i++)
{
if(qx[i])
{
rm[0]=X[qx[i]]+qk[i],rn[0]=X[qx[i]]-qk[i];
rm[1]=Y[qx[i]]+qk[i],rn[1]=Y[qx[i]]-qk[i];
rm[2]=i,rn[2]=0;
ans=0,query(root),printf("%d\n",ans);
}
}
return 0;
}