#include <bits/stdc++.h>
using namespace std;
const int N = 2E5 + 10;
int n, m;
int w[N];
struct node {
  int l, r;
  long long val;
  int fmin, fmax;
  long long lazy;
} t[N << 2];
void pushdown(node& op, long long lazy) {
  if (op.fmin >= lazy) return;
  lazy = max(lazy, op.lazy);
  op.val = lazy * (op.r - op.l + 1);
  op.fmin = lazy, op.fmax = lazy;
  op.lazy = lazy;
}
void pushdown(int x) {
  if (!t[x].lazy) return;
  pushdown(t[x << 1], t[x].lazy);
  pushdown(t[x << 1 | 1], t[x].lazy);
  t[x].lazy = 0;
}
void pushup(node& p, node& l, node& r) {
  p.val = l.val + r.val;
  p.fmin = min(l.fmin, r.fmin), p.fmax = max(l.fmax, r.fmax);
}
void pushup(int x) { pushup(t[x], t[x << 1], t[x << 1 | 1]); }
void build(int l, int r, int x = 1) {
  if (l == r) {
    t[x] = {l, r, w[l], w[l], w[l], 0};
    return;
  }
  t[x] = {l, r, 0, 0, 0, 0};
  int mid = l + r >> 1;
  build(l, mid, x << 1), build(mid + 1, r, x << 1 | 1);
  pushup(x);
}
void modify(int l, int r, int c, int x = 1) {
  if (t[x].fmin >= c) return;
  if (l <= t[x].l && r >= t[x].r) {
    if (t[x].fmax < c) {
      pushdown(t[x], c);
      return;
    }
  }
  pushdown(x);
  int mid = t[x].l + t[x].r >> 1;
  if (l <= mid) modify(l, r, c, x << 1);
  if (r > mid) modify(l, r, c, x << 1 | 1);
  pushup(x);
}
int ask(int l, int r, int& have, int x = 1) {
  if (t[x].fmin > have) return 0;
  if (t[x].l == t[x].r) {
    if (have >= t[x].val) {
      have -= t[x].val;
      return 1;
    }
    return 0;
  }
  if (t[x].l >= l && t[x].val <= have) {
    have -= t[x].val;
    return t[x].r - t[x].l + 1;
  }
  pushdown(x);
  int mid = t[x].l + t[x].r >> 1;
  int res = 0;
  if (l <= mid) res += ask(l, r, have, x << 1);
  if (r > mid) res += ask(l, r, have, x << 1 | 1);
  return res;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= (n); ++i) scanf("%d", &w[i]);
  build(1, n);
  while (m--) {
    int op, x, y;
    scanf("%d %d %d", &op, &x, &y);
    if (op == 1) {
      modify(1, x, y);
    } else {
      printf("%d\n", ask(x, n, y));
    }
  }
  return 0;
}
