#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
long long a[maxn];
struct Tree {
  long long l, r, maxval, minval, sum, tag;
} tree[maxn * 4];
void push_up(long long p) {
  tree[p].maxval = max(tree[p * 2].maxval, tree[p * 2 + 1].maxval);
  tree[p].minval = min(tree[p * 2].minval, tree[p * 2 + 1].minval);
  tree[p].sum = tree[p * 2].sum + tree[p * 2 + 1].sum;
}
void addtag(long long p, long long d) {
  tree[p].tag = d;
  tree[p].sum = tree[p].tag * (tree[p].r - tree[p].l + 1);
  tree[p].maxval = tree[p].tag;
  tree[p].minval = tree[p].tag;
}
void push_down(long long p) {
  if (tree[p].tag != -1) {
    addtag(p * 2, tree[p].tag);
    addtag(p * 2 + 1, tree[p].tag);
    tree[p].tag = -1;
  }
}
void build(long long p, long long l, long long r) {
  tree[p].l = l;
  tree[p].r = r;
  tree[p].maxval = -1e18;
  tree[p].minval = 1e18;
  tree[p].sum = 0;
  tree[p].tag = -1;
  if (l == r) {
    tree[p].maxval = tree[p].minval = tree[p].sum = a[l];
    return;
  }
  long long mid = (l + r) >> 1;
  build(p * 2, l, mid);
  build(p * 2 + 1, mid + 1, r);
  push_up(p);
}
void modify(long long p, long long l, long long r, long long d) {
  if (l <= tree[p].l && r >= tree[p].r) {
    if (tree[p].minval >= d) return;
    if (tree[p].maxval < d) {
      addtag(p, d);
      return;
    }
  }
  push_down(p);
  long long mid = (tree[p].l + tree[p].r) >> 1;
  if (l <= mid) modify(p * 2, l, r, d);
  if (r > mid) modify(p * 2 + 1, l, r, d);
  push_up(p);
}
long long query(long long p, long long l, long long r, long long &x) {
  if (l <= tree[p].l && r >= tree[p].r) {
    if (tree[p].minval > x) return 0;
    if (x >= tree[p].sum) {
      x -= tree[p].sum;
      return tree[p].r - tree[p].l + 1;
    }
    if (tree[p].l == tree[p].r) return 0;
  }
  long long ans = 0;
  push_down(p);
  long long mid = (tree[p].l + tree[p].r) >> 1;
  if (l <= mid) ans += query(p * 2, l, r, x);
  if (r > mid) ans += query(p * 2 + 1, l, r, x);
  return ans;
}
int main(void) {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  build(1, 1, n);
  while (m--) {
    long long op, l, r;
    cin >> op >> l >> r;
    if (op == 1) {
      modify(1, 1, l, r);
    } else if (op == 2) {
      cout << query(1, l, n, r) << endl;
    }
  }
  return 0;
}
