#include <bits/stdc++.h>
using namespace std;
long long n, q, a[200005];
struct nod {
  long long mi, mx, s, lazy;
} tr[200005 << 2];
void pushup(long long now, long long l, long long r) {
  tr[now].mx = max(tr[(now << 1)].mx, tr[((now << 1) | 1)].mx);
  tr[now].mi = min(tr[(now << 1)].mi, tr[((now << 1) | 1)].mi);
  tr[now].s = tr[(now << 1)].s + tr[((now << 1) | 1)].s;
}
void mdf(long long now, long long l, long long r, long long v) {
  tr[now].mx = tr[now].mi = v;
  tr[now].s = (r - l + 1) * v;
  tr[now].lazy = v;
}
void pushdown(long long now, long long l, long long r) {
  if (l == r) return;
  long long mid = (l + r) >> 1;
  if (tr[now].lazy) {
    tr[(now << 1)].mx = tr[((now << 1) | 1)].mx = tr[(now << 1)].mi =
        tr[((now << 1) | 1)].mi = tr[now].lazy;
    tr[(now << 1)].s = (mid - l + 1) * tr[now].lazy;
    tr[((now << 1) | 1)].s = (r - mid) * tr[now].lazy;
    tr[(now << 1)].lazy = tr[((now << 1) | 1)].lazy = tr[now].lazy;
    tr[now].lazy = 0;
  }
  pushup(now, l, r);
}
void ins(long long now, long long l, long long r, long long x, long long y,
         long long v) {
  if (tr[now].lazy) pushdown(now, l, r);
  if (x <= l && r <= y) {
    mdf(now, l, r, v);
    return;
  }
  long long mid = (l + r) >> 1;
  if (x <= mid) ins((now << 1), l, mid, x, y, v);
  if (y > mid) ins(((now << 1) | 1), mid + 1, r, x, y, v);
  pushup(now, l, r);
}
long long query(long long now, long long l, long long r, long long k) {
  if (tr[1].mi > k) return n + 1;
  if (tr[now].lazy) pushdown(now, l, r);
  if (l == r) return l;
  long long mid = (l + r) >> 1;
  if (tr[(now << 1)].mi <= k) return query((now << 1), l, mid, k);
  return query(((now << 1) | 1), mid + 1, r, k);
}
long long flag, sum, cnt;
long long solve(long long now, long long l, long long r, long long x) {
  if (tr[now].lazy) pushdown(now, l, r);
  if (!flag && l == r && x == l) flag = 1;
  if (l == r) {
    if (flag == 1 && sum >= tr[now].s) {
      sum -= tr[now].s;
      cnt++;
      return 1;
    }
    return 0;
  }
  long long mid = (l + r) >> 1;
  if (flag == 0) {
    if (x <= mid) {
      long long adc = solve((now << 1), l, mid, x);
      if (adc == 1) adc = solve(((now << 1) | 1), mid + 1, r, x);
      return adc;
    } else
      return solve(((now << 1) | 1), mid + 1, r, x);
  } else {
    if (sum >= tr[now].s) {
      sum -= tr[now].s, cnt += r - l + 1;
      return 1;
    } else {
      long long adc = solve((now << 1), l, mid, x);
      if (adc == 1) adc = solve(((now << 1) | 1), mid + 1, r, x);
      return adc;
    }
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin >> n >> q;
  for (long long i = 1, x; i <= n; i++) cin >> a[i], ins(1, 1, n, i, i, a[i]);
  for (long long i = 1, op, x, y; i <= q; i++) {
    cin >> op >> x >> y;
    if (op == 1) {
      long long pos = query(1, 1, n, y);
      if (pos > y)
        continue;
      else
        ins(1, 1, n, pos, x, y);
    } else {
      sum = y, cnt = 0;
      while (sum >= tr[1].mi) {
        flag = 0;
        long long pos = query(1, 1, n, sum);
        if (pos < x) pos = x;
        long long adc = solve(1, 1, n, pos);
        if (adc == 1) break;
      }
      cout << cnt << endl;
    }
  }
}
