#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 10;
long long a[MAX];
struct segTree {
  int left, right;
  long long sum, lazy, Max, Min;
} tree[4 * MAX + 10];
void pushup(int rt) {
  tree[rt].Max = max(tree[rt << 1].Max, tree[rt << 1 | 1].Max);
  tree[rt].Min = min(tree[rt << 1].Min, tree[rt << 1 | 1].Min);
  tree[rt].sum = tree[rt << 1].sum + tree[rt << 1 | 1].sum;
}
void build(int rt, int l, int r) {
  tree[rt].left = l, tree[rt].right = r;
  tree[rt].Max = 0x7f3f3f3f, tree[rt].Min = -0x7f3f3f3f;
  if (l == r) {
    tree[rt].sum = a[l];
    tree[rt].Max = tree[rt].Min = a[l];
    tree[rt].lazy = 0;
    return;
  }
  int mid = (l + r) >> 1;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  pushup(rt);
}
void addtag(int rt, long long lz) {
  tree[rt].sum = (tree[rt].right - tree[rt].left + 1) * lz;
  tree[rt].lazy = lz;
  tree[rt].Max = tree[rt].Min = lz;
}
void pushdown(int rt) {
  if (!tree[rt].lazy) return;
  int lc = rt << 1, rc = rt << 1 | 1;
  addtag(lc, tree[rt].lazy);
  addtag(rc, tree[rt].lazy);
  tree[rt].lazy = 0;
}
void modify(int rt, int l, int r, long long val) {
  if (tree[rt].left >= l && tree[rt].right <= r) {
    if (tree[rt].Min >= val) return;
    if (tree[rt].Max <= val) {
      addtag(rt, val);
      return;
    }
    if (tree[rt].left == tree[rt].right) return;
  }
  pushdown(rt);
  int mid = (tree[rt].left + tree[rt].right) >> 1;
  if (l <= mid) modify(rt << 1, l, r, val);
  if (r > mid) modify(rt << 1 | 1, l, r, val);
  pushup(rt);
}
long long query(int rt, int l, int r, long long &val) {
  if (tree[rt].left >= l && tree[rt].right <= r) {
    if (tree[rt].Min > val) return 0;
    if (val >= tree[rt].sum) {
      val -= tree[rt].sum;
      return tree[rt].right - tree[rt].left + 1;
    }
    if (tree[rt].left == tree[rt].right) return 0;
  }
  pushdown(rt);
  int mid = (tree[rt].left + tree[rt].right) >> 1;
  long long res = 0;
  if (l <= mid) res += query(rt << 1, l, r, val);
  if (r > mid) res += query(rt << 1 | 1, l, r, val);
  return res;
}
int main() {
  int Cas = 1;
  while (Cas--) {
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) scanf("%lld", a + i);
    build(1, 1, n);
    while (m--) {
      int op, x;
      long long y;
      scanf("%d%d%lld", &op, &x, &y);
      if (op == 1)
        modify(1, 1, x, y);
      else {
        printf("%lld\n", query(1, x, n, y));
      }
    }
  }
  return 0;
}
