#include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cerr << name <<   :   << arg1 << std::endl;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   template <typename T1, typename T2>   istream& operator>>(istream& in, pair<T1, T2>& a) {     in >> a.first >> a.second;     return in;   }   template <typename T1, typename T2>   ostream& operator<<(ostream& out, pair<T1, T2> a) {     out << a.first <<     << a.second;     return out;   }   template <typename T, typename T1>   T amax(T& a, T1 b) {     if (b > a) a = b;     return a;   }   template <typename T, typename T1>   T amin(T& a, T1 b) {     if (b < a) a = b;     return a;   }   const long long INF = 1e18;   const int32_t M = 1e9 + 7;   const int32_t MM = 998244353;   const long long N = 2 * 100005;   struct node {     long long mn, sum;     bool lazyset;     long long lazyval;     void assign(long long val) {       mn = val;       sum = val;     }     void merge(node& a, node& b) {       mn = min(a.mn, b.mn);       sum = a.sum + b.sum;     }   };   struct segtree {     node t[4 * N];     void pushdown(long long v, long long tl, long long tr) {       long long tm = (tl + tr) / 2;       if (t[v].lazyset) {         apply(v * 2, tl, tm, t[v].lazyval);         apply(v * 2 + 1, tm + 1, tr, t[v].lazyval);         t[v].lazyset = 0;       }     }     void apply(long long v, long long tl, long long tr, long long val) {       t[v].mn = val;       t[v].sum = val * (tr - tl + 1);       t[v].lazyset = 1;       t[v].lazyval = val;     }     void build(long long a[], long long v, long long tl, long long tr) {       if (tl == tr) {         t[v].assign(a[tl]);       } else {         long long tm = (tl + tr) / 2;         build(a, v * 2, tl, tm);         build(a, v * 2 + 1, tm + 1, tr);         t[v].merge(t[v * 2], t[v * 2 + 1]);       }       t[v].lazyset = 0;     }     long long query(long long v, long long tl, long long tr, long long l,                     long long r) {       if (tl > r || tr < l) return 0;       if (l <= tl && tr <= r) {         return t[v].sum;       }       pushdown(v, tl, tr);       long long tm = (tl + tr) / 2;       return query(v * 2, tl, tm, l, r) + query(v * 2 + 1, tm + 1, tr, l, r);     }     long long sumdescent(long long v, long long tl, long long tr, long long val) {       if (tl == tr) return t[v].sum > val ? tl : N;       pushdown(v, tl, tr);       long long tm = (tl + tr) / 2;       if (t[v * 2].sum > val) return sumdescent(v * 2, tl, tm, val);       return sumdescent(v * 2 + 1, tm + 1, tr, val - t[v * 2].sum);     }     long long descent(long long v, long long tl, long long tr, long long val) {       if (t[v].mn >= val) return tr + 1;       if (tl == tr) return tl;       pushdown(v, tl, tr);       long long tm = (tl + tr) / 2;       if (t[v * 2].mn < val) return descent(v * 2, tl, tm, val);       return descent(v * 2 + 1, tm + 1, tr, val);     }     void rupd(long long v, long long tl, long long tr, long long l, long long r,               long long val) {       if (tl > r || tr < l) return;       if (l <= tl && tr <= r) {         apply(v, tl, tr, val);         return;       }       pushdown(v, tl, tr);       long long tm = (tl + tr) / 2;       rupd(v * 2, tl, tm, l, r, val);       rupd(v * 2 + 1, tm + 1, tr, l, r, val);       t[v].merge(t[v * 2], t[v * 2 + 1]);     }   } st;   void solve() {     long long n, q;     cin >> n >> q;     long long a[n];     for (long long i = 0; i < n; ++i) {       cin >> a[i];     }     st.build(a, 1, 0, n - 1);     for (long long i = 0; i < q; ++i) {       long long t, x, y;       cin >> t >> x >> y;       if (t == 1) {         long long l = st.descent(1, 0, n - 1, y);         long long r = x - 1;         if (l <= r) st.rupd(1, 0, n - 1, l, r, y);       } else {         long long cur = y;         long long idx = x - 1;         long long ans = 0;         while (idx < n) {           long long nxtidx = st.descent(1, 0, n - 1, cur + 1);           amax(idx, nxtidx);           long long sumidx =               st.sumdescent(1, 0, n - 1,                             cur + st.query(1, 0, n - 1, 0, idx - 1)) -               1;           amin(sumidx, n - 1);           ans += sumidx - idx + 1;           cur -= st.query(1, 0, n - 1, idx, sumidx);           idx = sumidx + 1;         }         cout << ans <<   n ;       }     }   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t = 1;     while (t--) solve();     return 0;   }