#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
struct node {
  long long l;
  long long r;
  long long lz;
  long long maxv;
  long long minv;
  long long sum;
} tr[N << 2];
long long a[N];
long long n;
void pushup(long long u) {
  tr[u].maxv = max(tr[u << 1].maxv, tr[u << 1 | 1].maxv);
  tr[u].minv = min(tr[u << 1].minv, tr[u << 1 | 1].minv);
  tr[u].sum = tr[u << 1].sum + tr[u << 1 | 1].sum;
}
void pushdown(long long u) {
  if (!tr[u].lz) return;
  tr[u << 1].lz = tr[u].lz;
  tr[u << 1 | 1].lz = tr[u].lz;
  tr[u << 1].minv = tr[u << 1 | 1].maxv = tr[u << 1].maxv =
      tr[u << 1 | 1].minv = tr[u].lz;
  tr[u << 1].sum = (tr[u].lz * (tr[u << 1].r - tr[u << 1].l + 1));
  tr[u << 1 | 1].sum = tr[u].lz * (tr[u << 1 | 1].r - tr[u << 1 | 1].l + 1);
  tr[u].lz = 0;
  return;
}
void build(long long u, long long l, long long r) {
  tr[u] = {l, r};
  if (l == r) {
    tr[u].maxv = tr[u].minv = tr[u].sum = a[l];
    return;
  }
  long long mid = l + r >> 1;
  build(u << 1, l, mid), build(u << 1 | 1, mid + 1, r);
  pushup(u);
}
long long q;
void mdf(long long u, long long l, long long r, long long d) {
  if (tr[u].l >= l && tr[u].r <= r) {
    if (tr[u].minv >= d) return;
    if (tr[u].maxv < d) {
      tr[u].maxv = tr[u].minv = d;
      tr[u].lz = d;
      tr[u].sum = (tr[u].r - tr[u].l + 1) * d;
      return;
    }
  }
  pushdown(u);
  long long mid = tr[u].l + tr[u].r >> 1;
  if (l <= mid) mdf(u << 1, l, r, d);
  if (r > mid) mdf(u << 1 | 1, l, r, d);
  pushup(u);
}
long long query(long long u, long long l, long long r, long long &d) {
  if (tr[u].l >= l && tr[u].r <= r) {
    if (tr[u].l == tr[u].r) {
      if (tr[u].maxv <= d) {
        d -= tr[u].maxv;
        return 1;
      } else
        return 0;
    }
    if (tr[u].sum <= d) {
      d -= tr[u].sum;
      return tr[u].r - tr[u].l + 1;
    }
    if (tr[u].minv > d) return 0;
  }
  pushdown(u);
  long long res = 0;
  long long mid = tr[u].l + tr[u].r >> 1;
  if (l <= mid) res += query(u << 1, l, r, d);
  if (r > mid) res += query(u << 1 | 1, l, r, d);
  return res;
}
signed main() {
  cin >> n >> q;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  build(1, 1, n);
  while (q--) {
    long long op, l, r;
    cin >> op >> l >> r;
    if (op == 1) {
      mdf(1, 1, l, r);
    } else {
      cout << query(1, l, n, r) << endl;
    }
  }
  return 0;
}
