#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>

using namespace std;

#define int long long

int inf = 1000000000;

mt19937 rnd_(12);


vector <vector <int>> g;

int hs(int u , int v) {
    return u*inf+ v;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n , q;
    cin >> n >> q;

    vector <int> a (n);

    for (int i  = 0 ; i < n; i++)
        cin >> a[i];

    vector <vector <int>> col(n);

    col.resize(n);
    for (int i = 0 ; i < n;  i++)
        col[i].resize(n);

    for (int ms = 1 ; ms < (1 << n) ; ms++) {
        int mx = 0;
        int s = 0;

        int l = inf;
        int r = -inf;

        int ans = 0;

        for (int i = 0 ; i < n; i++) {
            if ((ms & (1 << i)) != 0) {
                l= min(l , i);
                r= max(r , i);

                ans++;

                s += a[i];
                mx = max(mx , s);
            }
        }

        if (s == mx) {
            col[l][r]= max(col[l][r] , ans);
        }
    }


    while (q--)
    {
        int t;
        cin >> t;

        if (t == 2) {
            int l ,  r;
            cin >> l >> r;
            l--;
            r--;

            int ans = 0;

            for (int i = 0 ; i < n;  i++) {
                for (int j = i ; j < n;  j++) {
                    if ((l <=i) and (j <= r)) {
                        ans = max(ans , col[i][j]);
                    }
                }
            }

            cout << ans << "\n";
        }
        else {
            int ind;
            cin >> ind;

            ind--;
            a[ind] *= -1;
        }
    }

}
