#include <bits/stdc++.h>

using namespace std;
typedef int ll;

#define endl '\n'

int dp[101][201][201];

ll can[20][20];

void precnt(ll n, vector<ll> a){
    for(int i = 1; i < (1ll << n); i++){
        ll tot = 0;

        for(int j = 0; j < n; j++){
            if((i >> j) & 1)
                tot += a[j + 1];
        }

        ll cur = 0, mn = -1, mx = 0, cnt = 0;
        bool ok = true;

        for(int j = 0; j < n; j++){
            if((i >> j) & 1){
                cur += a[j + 1];
                cnt += 1;

                if(cur < 0 || tot < 0 || tot - cur < 0){
                    ok = false;
                    break;
                }
                if(mn == -1)
                    mn = j;
                mx = j;
            }
        }
        mn++, mx++;

        if(ok)
            can[mn][mx] = max(can[mn][mx], cnt);
    }
}

ll cor(ll l, ll r){
    ll ans = 0;

    for(int i = l; i <= r; i++)
        for(int j = i; j <= r; j++)
            ans = max(ans, can[i][j]);

    return ans;
}


bool const local = false;

int main(){
    srand(time(0));

    ll test = (local ? 10000 : 1);

    while(test--){
    ll n, q;

    if(!local)
        cin >> n >> q;
    else
        n = 1 + rand() % 5, q = 1000;

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            can[i][j] = 0;

    vector<ll> a(n + 1);
    for(int i = 1; i <= n; i++){
        if(!local)
            cin >> a[i];
        else
            a[i] = (rand() % 2 != 0 ? -1 : 1);
    }

    precnt(n, a);

    while(q--){
        ll type;

        if(!local)
            cin >> type;
        else
            type = 2;

        if(type == 1){
            ll p;
            cin >> p;

            a[p] = -a[p];
        }
        else{
            ll l, r;
            if(!local)
                cin >> l >> r;
            else{
                l = 1 + rand() % n;
                r = l + rand() % (n - l + 1);
            }

            for(int i = l; i <= r; i++)
                for(int s = -n; s <= n; s++)
                    for(int s2 = -n; s2 <= n; s2++)
                        dp[i][s + n][s2 + n] = 0;

            if(a[l] == 1)
                for(int j = -1; j <= n; j++)
                    dp[l][1 + n][j + n] = 1;

            for(int i = l + 1; i <= r; i++){
                for(int s = -n; s <= n; s++){
                    for(int s2 = -n; s2 <= n; s2++){
                        dp[i][n + s][n + s2] = dp[i - 1][n + s][n + s2];

                        if(s >= 0 && s2 + a[i] >= 0){
                            // cout << "t " << s << ' ' << s2 << ' ' << a[i] << ' ' <<  i << endl;
                            dp[i][n + s][n + s2] = max(dp[i][n + s][n + s2], dp[i - 1][n + s - a[i]][n + s2 + a[i]] + 1);
                        }
                    }
                }
            }

            ll ans = 0;
            for(int i = 0; i <= n; i++)
                ans = max(ans, dp[r][i + n][0 + n]);

            ll need = cor(l, r);

            if(ans != need){
                cout << n << ' ' << 1 << endl;

                for(int i = 1; i <= n; i++)
                    cout << a[i] << ' ';
                cout << endl;

                cout << 2 << ' ' << l << ' ' << r << endl;

                cout << ans << ' ' << need << endl;

                return 0;
            }

            if(!local)
                cout << ans << endl;
        }
    }
    }

    return 0;
}

/*
5 1
-1 1 1 -1 1
2 3 5

*/
