
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define mkp make_pair
#define pb push_back
using namespace std;
int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,q;
    cin>>n>>q;
    ll a[n+2],sum[n+2];
    sum[0]=0;
    for(ll i=1; i<=n; i++)
    {
        cin>>a[i];
        sum[i]=sum[i-1]+a[i];
    }
    while(q--)
    {
        ll type;
        cin>>type;
        if(type==1)
        {
            ll p;
            cin>>p;
            a[p]=-1*a[p];
            for(ll i=p; i<=n; i++){sum[i]=sum[i-1]+a[i]; }
        }
        if(type==2)
        {
            ll l,r;
            cin>>l>>r;
            ll ans=0;
            for(ll i=l; i<=r; i++)
            {
                for(ll j=r; j>=i; j--)
                {
                    bool t2=1;
                    for(ll m=i; m<=j; m++)
                    {
                        if(sum[m]-sum[i-1]<0 || sum[j]-sum[m-1]<0){t2=0; break;}
                    }
                    if(t2){ans=max(ans,j-i+1);}

                }
            }
            cout<<ans<<'\n';
        }
    }
}

