#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;
}

int main(){
    ll n, q;
    cin >> n >> q;

    vector<ll> a(n + 1);
    for(int i = 1; i <= n; i++)
        cin >> a[i];

    precnt(n, a);
    while(q--){
        ll type;
        cin >> type;

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

            a[p] = -a[p];
        }
        else{
            ll l, r;
            cin >> l >> r;

            cout << cor(l, r) << endl;
        }
    }

    return 0;
}

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

*/
