n,q=map(int,input().split())
a1=input().split()
a=[]
b1=[]
b=[]
for i in a1:
    a.append(int(i))
for i in range(q):
    b1.append(input().split())
for i in range(q):
    b.append([])
    for j in b1[i]:
        b[i].append(int(j))
lens=[]
for i in range(q):
    if b[i][0]==1:
        if a[b[i][1]]==1:
            a[b[i][1]]=-1
        else:
            a[b[i][1]]=1
    else:
        n1=b[i][1]
        n2=b[i][2]
        mass=a[n1:n2]
        for j in range(len(mass)):
            rs=0
            k=0
            l=0
            for i1 in range(0,j-1):
                
                #print(mass[i1])
                k+=mass[i1]
                if k<0:
                    k=0
                    if rs!=0:
                        lens.append(rs)
                        rs=0
                    continue
                else:
                    k=0
            for i1 in range(j-1,len(mass)):
                
                #print(mass[i1])
                l+=mass[i1]
                if l<0:
                    l=0
                    if rs!=0:
                        lens.append(rs)
                        rs=0
                    continue
                else:
                    rs+=1
                    l=0
        lens.append(rs)
    print(max(lens))
    lens.clear()