#include <bits/stdc++.h>
using namespace std;
int a[200000 + 10];
const int N = 800000 + 10;
struct segtree {
  int minn[N], laze[N];
  long long sum[N];
  void pushdown(int l, int r, int rt) {
    if (laze[rt]) {
      int mid = (l + r) / 2;
      minn[rt * 2] = minn[rt * 2 + 1] = laze[rt];
      sum[rt * 2] = (long long)laze[rt] * (mid - l + 1);
      sum[rt * 2 + 1] = (long long)laze[rt] * (r - mid);
      laze[rt * 2] = laze[rt * 2 + 1] = laze[rt];
      laze[rt] = 0;
    }
    return;
  }
  void pushup(int l, int r, int rt) {
    minn[rt] = min(minn[rt * 2], minn[rt * 2 + 1]);
    sum[rt] = sum[rt * 2] + sum[rt * 2 + 1];
    return;
  }
  void build(int l, int r, int rt) {
    if (l == r) {
      minn[rt] = sum[rt] = a[l];
      return;
    }
    int mid = (l + r) / 2;
    build(l, mid, rt * 2);
    build(mid + 1, r, rt * 2 + 1);
    pushup(l, r, rt);
  }
  void updata(int l, int r, int ql, int qr, int val, int rt) {
    if (ql <= l && qr >= r) {
      minn[rt] = val;
      sum[rt] = (long long)(r - l + 1) * val;
      laze[rt] = val;
      return;
    }
    pushdown(l, r, rt);
    int mid = (l + r) / 2;
    if (ql <= mid) updata(l, mid, ql, qr, val, rt * 2);
    if (qr > mid) updata(mid + 1, r, ql, qr, val, rt * 2 + 1);
    pushup(l, r, rt);
  }
  int qry_minpos(int l, int r, int ql, int qr, int val, int rt) {
    if (l == r) return l;
    pushdown(l, r, rt);
    int mid = (l + r) / 2;
    if (ql <= mid && minn[rt * 2] <= val)
      return qry_minpos(l, mid, ql, qr, val, rt * 2);
    else
      return qry_minpos(mid + 1, r, ql, qr, val, rt * 2 + 1);
    pushup(l, r, rt);
  }
  long long qry_sum(int l, int r, int ql, int qr, int rt) {
    if (l >= ql && r <= qr) return sum[rt];
    pushdown(l, r, rt);
    int mid = (l + r) / 2;
    long long ans = 0;
    if (ql <= mid) ans += qry_sum(l, mid, ql, qr, rt * 2);
    if (qr > mid) ans += qry_sum(mid + 1, r, ql, qr, rt * 2 + 1);
    pushup(l, r, rt);
    return ans;
  }
  int qry_rpos(int l, int r, long long val, int rt) {
    if (l == r) return l;
    pushdown(l, r, rt);
    int mid = (l + r) / 2;
    int ans = 0;
    if (sum[rt * 2] <= val)
      ans = qry_rpos(mid + 1, r, val - sum[rt * 2], rt * 2 + 1);
    else
      ans = qry_rpos(l, mid, val, rt * 2);
    pushup(l, r, rt);
    return ans;
  }
} seg;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  for (int i = (1); i < (n + 1); i++) {
    cin >> a[i];
  }
  seg.build(1, n + 1, 1);
  while (q--) {
    int op, x, y;
    cin >> op >> x >> y;
    if (op == 1) {
      int pos = seg.qry_minpos(1, n + 1, 1, n, y, 1);
      seg.updata(1, n + 1, pos, x, y, 1);
    } else {
      int ans = 0;
      while (x <= n) {
        int pos = seg.qry_minpos(1, n + 1, x, n, y, 1);
        long long presum = 0;
        if (pos != 1) presum = seg.qry_sum(1, n + 1, 1, pos - 1, 1);
        int r = seg.qry_rpos(1, n + 1, y + presum, 1);
        y -= seg.qry_sum(1, n + 1, 1, r - 1, 1) - presum;
        ans += r - pos;
        x = r;
      }
      cout << ans << "\n";
    }
  }
  return 0;
}
