#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    // freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, q;
    cin>>n>>q;
    vector<ll> a(n);
    for (int tst = 0; tst < n; tst++) {
        cin>>a[tst];
    }
    for (int tst = 0; tst < q; tst++) {
        int tp, l, r;
        cin>>tp>>l>>r; l--; r--;
        int sz = r - l + 1;
        int cnt = 0;
        for (int msk = 0; msk < pow(2, sz); msk++) {
            vector<ll> ar;
            int cm = msk;
            int i = 0;
            while (cm) {
                if (cm & 1) {
                    ar.push_back(a[i + l]);
                }
                cm >>= 1;
                i++;
            }
            ll sm = 0;
            bool cn = true;
            for (auto& el : ar) {
                // cout << el << " ";
                sm += el;
                if (sm < 0) {
                    cn = false;
                    break;
                }
            }
            // cout << endl;
            reverse(ar.begin(), ar.end());
            sm = 0;
            for (auto& el : ar) {
                sm += el;
                if (sm < 0) {
                    cn = false;
                    break;
                }
            }
            if (!cn) {
                continue;
            }
            cnt = max(cnt, (int)ar.size());
        }
        cout << cnt << endl;
    }
}
