n,q = map(int,input().split())
a = list(map(int,input().split()))
prs = [0 for _ in range(n)]

for i in range(n):
    prs[i] = prs[max(0,i-1)]+a[i]

#print(prs)

for qi in range(q):
    t = list(map(int,input().split()))
    if(t[0]==1):
        #print("first")
        a[t[1]-1]=-a[t[1]-1]
        for i in range(t[1]-1,n):
            prs[i]+=2*a[t[1]-1]
        #print(prs)
    else:
        #print("second")
        maxp =0
        p=0
        mi = prs[max(t[1]-2,0)]
        if(t[1]==1):
            mi=0
        for j in range(t[1]-1,t[2]):
            if(prs[j]-mi>=0):
                if((j==0 and prs[-1]>=0) or prs[-1]-prs[j-1]>=0):
                    p+=1
                    maxp = max(maxp,p)
            else:
                p=0
        print(maxp)