#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, m, q;
long long w[N];
struct node {
  int l, r;
  long long sum, maxx, minn, tag;
} tr[N * 4];
void pushup(int u) {
  tr[u].sum = tr[u << 1].sum + tr[u << 1 | 1].sum;
  tr[u].minn = min(tr[u << 1].minn, tr[u << 1 | 1].minn);
  tr[u].maxx = max(tr[u << 1].maxx, tr[u << 1 | 1].maxx);
}
void pushdown(int u) {
  auto &root = tr[u], &lson = tr[u << 1], &rson = tr[u << 1 | 1];
  if (root.tag) {
    lson.tag = rson.tag = root.tag;
    lson.maxx = lson.minn = root.tag;
    rson.maxx = rson.minn = root.tag;
    lson.sum = root.tag * (lson.r - lson.l + 1);
    rson.sum = root.tag * (rson.r - rson.l + 1);
    root.tag = 0;
  }
}
void build(int u, int l, int r) {
  tr[u].l = l, tr[u].r = r;
  if (l == r) {
    tr[u].sum = tr[u].maxx = tr[u].minn = w[l];
    tr[u].tag = 0;
    return;
  }
  int mid = l + r >> 1;
  build(u << 1, l, mid), build(u << 1 | 1, mid + 1, r);
  pushup(u);
}
void update(int u, int l, int r, long long k) {
  if (tr[u].minn >= k) return;
  if (tr[u].l >= l && tr[u].r <= r && tr[u].maxx <= k) {
    tr[u].sum = k * (tr[u].r - tr[u].l + 1);
    tr[u].minn = tr[u].maxx = tr[u].tag = k;
    return;
  }
  pushdown(u);
  int mid = tr[u].l + tr[u].r >> 1;
  if (l <= mid) update(u << 1, l, r, k);
  if (r > mid) update(u << 1 | 1, l, r, k);
  pushup(u);
}
long long query(int u, int l, int r, long long &k) {
  if (tr[u].minn > k) return 0ll;
  if (tr[u].l >= l && tr[u].r <= r && tr[u].sum <= k) {
    k -= tr[u].sum;
    return 1ll * (tr[u].r - tr[u].l + 1);
  }
  pushdown(u);
  long long res = 0;
  int mid = tr[u].l + tr[u].r >> 1;
  if (l <= mid) res += query(u << 1, l, r, k);
  if (r > mid) res += query(u << 1 | 1, l, r, k);
  return res;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%lld", &w[i]);
  build(1, 1, n);
  int op, x;
  long long y;
  while (q--) {
    scanf("%d%d%lld", &op, &x, &y);
    if (op == 1)
      update(1, 1, x, y);
    else
      printf("%lld\n", query(1, x, n, y));
  }
  return 0;
}
