#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 9, M = 6e6 + 10;
int n, q;
int a[N];
struct node {
  int l, r, len;
  long long sum, mi, lzy;
} tr[N << 2];
void pushup(int rt) {
  tr[rt].sum = tr[rt << 1].sum + tr[rt << 1 | 1].sum;
  tr[rt].mi = min(tr[rt << 1 | 1].mi, tr[rt << 1].mi);
}
void pushdown(int rt) {
  if (tr[rt].lzy) {
    long long lzy = tr[rt].lzy;
    tr[rt << 1].lzy = max(lzy, tr[rt << 1].lzy);
    tr[rt << 1].mi = (lzy);
    tr[rt << 1].sum = lzy * tr[rt << 1].len;
    tr[rt << 1 | 1].lzy = max(lzy, tr[rt << 1 | 1].lzy);
    tr[rt << 1 | 1].mi = (lzy);
    tr[rt << 1 | 1].sum = lzy * tr[rt << 1 | 1].len;
    tr[rt].lzy = 0;
  }
}
void build(int rt, int l, int r) {
  if (l == r) {
    tr[rt] = {l, l, 1, a[l], a[l], 0};
    return;
  }
  int mid = (l + r) >> 1;
  tr[rt] = {l, r, r - l + 1};
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  pushup(rt);
}
void update(int rt, int l, int r, long long d) {
  if (l <= tr[rt].l && r >= tr[rt].r) {
    tr[rt].lzy = max(d, tr[rt].lzy);
    tr[rt].mi = (d);
    tr[rt].sum = d * tr[rt].len;
    return;
  }
  pushdown(rt);
  int mid = (tr[rt].l + tr[rt].r) >> 1;
  if (mid >= l) update(rt << 1, l, r, d);
  if (mid < r) update(rt << 1 | 1, l, r, d);
  pushup(rt);
}
int query1(int rt, long long d) {
  if (tr[rt].len == 1) return tr[rt].l;
  int mid = (tr[rt].l + tr[rt].r) >> 1;
  pushdown(rt);
  if (tr[rt << 1].mi < d)
    return query1(rt << 1, d);
  else
    return query1(rt << 1 | 1, d);
}
int query(int rt, int l, int r, int &d) {
  int sum = 0;
  if (tr[rt].mi > d) return 0;
  if (tr[rt].l >= l && tr[rt].r <= r && tr[rt].sum <= d) {
    d -= tr[rt].sum;
    return tr[rt].len;
  }
  pushdown(rt);
  int mid = (tr[rt].l + tr[rt].r) >> 1;
  if (mid >= l) sum += query(rt << 1, l, r, d);
  if (mid < r) sum += query(rt << 1 | 1, l, r, d);
  return sum;
}
void solve() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  build(1, 1, n);
  while (q--) {
    int op, x, y;
    scanf("%d%d%d", &op, &x, &y);
    if (op == 1) {
      if (tr[1].mi < y) {
        int pos = query1(1, y);
        if (pos <= x) update(1, pos, x, y);
      }
    } else {
      printf("%d\n", query(1, x, n, y));
    }
  }
}
int main() {
  int _;
  _ = 1;
  while (_--) {
    solve();
  }
  return 0;
}
