#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;
            bool cn = true;
            int cc = 0;
            ll sm = 0;
            while (cm) {
                if (cm & 1) {
                    cc++;
                    sm += a[i + l];
                    if (sm < 0) {
                        cn = false;
                        break;
                    }
                }
                cm >>= 1;
                i++;
            }
            if (!cn) {
                continue;
            }
            cm = msk;
            sm = 0;
            i = r - l;
            while (i >= 0) {
                if ((cm >> i) & 1) {
                    sm += a[i + l];
                    if (sm < 0) {
                        cn = false;
                        break;
                    }
                }
                i--;
            }
            if (!cn) {
                continue;
            }
            cnt = max(cnt, cc);
        }
        cout << cnt << endl;
    }
}
