#include <bits/stdc++.h>
using namespace std;
bool check(long long n, long long pos) { return n & (1LL << pos); }
long long Set(long long n, long long pos) { return n = n | (1LL << pos); }
struct segTreemin {
  long long n;
  vector<long long> tree, lazy;
  segTreemin(long long n) : n(n), tree(4 * n, 0), lazy(4 * n, -1) {}
  void propagate(long long node, long long l, long long r) {
    if (lazy[node] != -1) {
      tree[node] = lazy[node];
      if (l != r) lazy[2 * node] = lazy[node], lazy[2 * node + 1] = lazy[node];
    }
    lazy[node] = -1;
  }
  void treeUpdate(long long node, long long l, long long r, long long u,
                  long long v, long long val) {
    long long mid = (l + r) >> 1;
    propagate(node, l, r);
    if (l > v || r < u) return;
    if (l >= u && r <= v) {
      lazy[node] = val;
      propagate(node, l, r);
      return;
    }
    treeUpdate(2 * node, l, mid, u, v, val);
    treeUpdate(2 * node + 1, mid + 1, r, u, v, val);
    tree[node] = min(tree[2 * node], tree[2 * node + 1]);
  }
  void update(long long l, long long r, long long val) {
    treeUpdate(1, 1, n, l, r, val);
  }
  long long treeQuery(long long node, long long l, long long r, long long val) {
    if (tree[node] > val) return n + 1;
    long long mid = (l + r) >> 1;
    propagate(node, l, r);
    if (l == r) return l;
    if (tree[2 * node] <= val) return treeQuery(2 * node, l, mid, val);
    return treeQuery(2 * node + 1, mid + 1, r, val);
  }
  long long query(long long val) { return treeQuery(1, 1, n, val); }
};
struct segTreesum {
  long long n;
  vector<long long> tree, lazy;
  segTreesum(long long n) : n(n), tree(4 * n, 0), lazy(4 * n, -1) {}
  void propagate(long long node, long long l, long long r) {
    if (lazy[node] != -1) {
      tree[node] = lazy[node] * (r - l + 1);
      if (l != r) lazy[2 * node] = lazy[node], lazy[2 * node + 1] = lazy[node];
    }
    lazy[node] = -1;
  }
  void treeUpdate(long long node, long long l, long long r, long long u,
                  long long v, long long val) {
    long long mid = (l + r) >> 1;
    propagate(node, l, r);
    if (l > v || r < u) return;
    if (l >= u && r <= v) {
      lazy[node] = val;
      propagate(node, l, r);
      return;
    }
    treeUpdate(2 * node, l, mid, u, v, val);
    treeUpdate(2 * node + 1, mid + 1, r, u, v, val);
    tree[node] = (tree[2 * node] + tree[2 * node + 1]);
  }
  void update(long long l, long long r, long long val) {
    treeUpdate(1, 1, n, l, r, val);
  }
  long long treeQuery(long long node, long long l, long long r, long long u,
                      long long v) {
    long long mid = (l + r) >> 1;
    propagate(node, l, r);
    if (l > v || r < u) return 0;
    if (l >= u && r <= v) return tree[node];
    return (treeQuery(2 * node, l, mid, u, v) +
            treeQuery(2 * node + 1, mid + 1, r, u, v));
  }
  long long query(long long l, long long r) { return treeQuery(1, 1, n, l, r); }
  long long treeQuery2(long long node, long long l, long long r,
                       long long val) {
    long long mid = (l + r) >> 1;
    propagate(node, l, r);
    if (l == r) {
      if (tree[node] <= val) return l;
      return l - 1;
    }
    propagate(2 * node, l, mid);
    if (tree[2 * node] >= val) return treeQuery2(2 * node, l, mid, val);
    propagate(2 * node + 1, mid + 1, r);
    return treeQuery2(2 * node + 1, mid + 1, r, val - tree[2 * node]);
  }
  long long query2(long long val) { return treeQuery2(1, 1, n, val); }
};
long long arr[200005];
int main() {
  long long i, j, k, l, m, n, o, r, q;
  long long testcase;
  long long input, flag, tag, ans;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  while (cin >> n >> m) {
    segTreemin seg1(n);
    segTreesum seg2(n);
    for (long long i = 1; i <= n; i++) {
      cin >> arr[i];
      seg1.update(i, i, arr[i]);
      seg2.update(i, i, arr[i]);
    }
    for (long long i = 1; i <= m; i++) {
      long long t, x, y;
      cin >> t >> x >> y;
      if (t == 1) {
        long long pos = seg1.query(y);
        if (pos <= x) {
          seg1.update(pos, x, y);
          seg2.update(pos, x, y);
        }
      } else {
        ans = 0;
        while (y) {
          long long pos = seg1.query(y);
          pos = max(pos, x);
          if (pos > n) break;
          long long tot = y;
          if (pos > 1) tot += seg2.query(1, pos - 1);
          long long ret = seg2.query2(tot);
          ans += ret - pos + 1;
          y -= seg2.query(pos, ret);
          x = ret + 1;
          assert(y >= 0);
        }
        cout << ans << "\n";
      }
    }
  }
}
