#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 1000;
int read() {
  int ans = 0;
  bool f = 0;
  char ch = getchar();
  while (ch < '0' or ch > '9') {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (ch >= '0' and ch <= '9') {
    ans = (ans << 1) + (ans << 3) + (ch ^ 48);
    ch = getchar();
  }
  return f ? ~ans + 1 : ans;
}
int n, a[maxn], t, m, op, u, v;
struct sd {
  int l, r, ls, rs;
  long long datamax, datasum, f;
} tr[maxn << 2];
int nw(int l, int r) {
  tr[++t] = (sd){l, r, 0, 0, 0, 0, 0};
  return t;
}
void xf(int o) {
  if (tr[o].f) {
    tr[o].datamax = tr[o].f;
    tr[o].datasum = tr[o].f * (tr[o].r - tr[o].l + 1);
    tr[tr[o].ls].f = tr[o].f;
    tr[tr[o].rs].f = tr[o].f;
    tr[o].f = 0;
  }
}
void gx(int o) {
  xf(o), xf(tr[o].ls), xf(tr[o].rs);
  tr[o].datasum = tr[tr[o].ls].datasum + tr[tr[o].rs].datasum;
  tr[o].datamax = max(tr[tr[o].ls].datamax, tr[tr[o].rs].datamax);
}
void build(int o) {
  if (tr[o].l == tr[o].r) {
    tr[o].datamax = tr[o].datasum = a[tr[o].l];
    return;
  }
  int mid = tr[o].l + tr[o].r >> 1;
  build(tr[o].ls = nw(tr[o].l, mid));
  build(tr[o].rs = nw(mid + 1, tr[o].r));
  gx(o);
}
int fmax(int o, int x) {
  xf(o), xf(tr[o].ls), xf(tr[o].rs);
  if (tr[o].l == tr[o].r) {
    if (tr[o].datamax > x) return tr[o].l + 1;
    return tr[o].l;
  }
  int mid = tr[o].l + tr[o].r >> 1;
  if (tr[tr[o].rs].datamax >= x)
    fmax(tr[o].rs, x);
  else
    fmax(tr[o].ls, x);
}
void xg(int o, int l, int r, int val) {
  xf(o);
  if (tr[o].l == l and tr[o].r == r) {
    tr[o].f = val;
    return;
  }
  int mid = tr[o].l + tr[o].r >> 1;
  if (l > mid)
    xg(tr[o].rs, l, r, val);
  else if (r <= mid)
    xg(tr[o].ls, l, r, val);
  else
    xg(tr[o].ls, l, mid, val), xg(tr[o].rs, mid + 1, r, val);
  gx(o);
}
int cx(int o, int p) {
  xf(o);
  if (p <= tr[o].l and tr[o].datasum <= v) {
    v -= tr[o].datasum;
    return tr[o].r + 1;
  }
  if (tr[o].l == tr[o].r) return tr[o].l;
  int mid = tr[o].l + tr[o].r >> 1;
  int tt = 0;
  if (p <= mid) tt = cx(tr[o].ls, p);
  if (!tt or tt == mid + 1) return cx(tr[o].rs, p);
  return tt;
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  build(nw(1, n));
  while (m) {
    m--;
    op = read(), u = read(), v = read();
    if (op == 1) {
      int pos = fmax(1, v);
      if (pos <= u) xg(1, pos, u, v);
    }
    if (op == 2) {
      int ans = 0, now = u, r, tt;
      while (now < n + 1 and (tt = max(now, fmax(1, v))) and tt < n + 1) {
        r = cx(1, tt);
        ans += r - tt, now = r + 1;
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
