n,q=map(int,input().split()) a=list(map(int,input().split())) B=317 st1=[0]*B*B st2=[0]*B for i in range(n-1): st1[i]=a[i+1]-a[i] for i in range(B): st2[i]=st1[i*B:i*B+B].count(0) for _ in range(q): t,*que,=map(int,input().split()) if t==1: l,r,x=que l-=1 r-=1 if l-1>=0: st1[l-1]+=x y=(l-1)//B st2[y]=st1[y*B:y*B+B].count(0) st1[r]-=x y=r//B st2[y]=st1[y*B:y*B+B].count(0) if t==2: l,r=que l-=1 r-=1 r-=1 a=0 yl=l//B yr=r//B if yl==yr: a+=st1[l:r+1].count(0) else: a+=st1[l:yl*B+B].count(0) a+=st1[yr*B:r+1].count(0) a+=sum(st2[yl+1:yr]) print(r-l+1-a+1)