#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi (4*atan(1.0))
const int N=1e5+10,M=1e6+1010,inf=1e9+10,mod=1e9+7;
const ll INF=1e18+10;
ll a[M];
int n,si,q;
ll up[2010];
int getpos(int l)
{
return (l-1)/si+1;
}
void update(int l,int r,ll c)
{
int R=(getpos(r)-1+(r%si?0:1))*si;
int L=(getpos(l)-(l%si==1?1:0))*si+1;
int flag=0;
while(l<L)
{
a[l]+=c;
l++;
flag=1;
}
if(flag)
sort(a+L-si+1,a+L+1);
flag=0;
while(L<=R)
{
up[getpos(L)]+=c;
L+=si;
}
while(R+1<=r)
{
a[R+1]+=c;
R++;
flag=1;
}
if(flag)
sort(a+R+1,a+min(n+1,R+si+1));
}
int query(int l,int r,ll k)
{
int ans=0;
int R=(getpos(r)-1+(r%si?0:1))*si;
int L=(getpos(l)-(l%si==1?1:0))*si+1;
while(l<L)
{
if(a[l]+up[getpos(l)]>=k)
ans++;
l++;
}
while(L<=R)
{
int pos=lower_bound(a+L,a+L+si,k-up[getpos(L)])-a;
ans+=L+si-pos;
L+=si;
}
while(R+1<=r)
{
if(a[R+1]+up[getpos(R+1)]>=k)
ans++;
R++;
}
return ans;
}
char ch[10];
int main()
{
scanf("%d%d",&n,&q);
memset(up,0,sizeof(up));
si=sqrt(n);
for(int i=1; i<=n; i++)
scanf("%lld",&a[i]);
for(int i=1; i<=n/si; i++)
sort(a+(i-1)*si+1,a+i*si+1);
sort(a+si*(n/si)+1,a+n+1);
while(q--)
{
int l,r;
ll c;
scanf("%s%d%d%lld",ch,&l,&r,&c);
if(ch[0]==‘M‘)
update(l,r,c);
else
printf("%d\n",query(l,r,c));
}
return 0;
}