#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 10;
int n, m, w[N];
struct Node {
  int l, r;
  long long maxv, minv, sum, lazy;
} tr[N * 4];
void pushup(int u) {
  tr[u].maxv = max(tr[u << 1].maxv, tr[u << 1 | 1].maxv);
  tr[u].minv = min(tr[u << 1].minv, tr[u << 1 | 1].minv);
  tr[u].sum = tr[u << 1].sum + tr[u << 1 | 1].sum;
}
void eval(int u, int v) {
  tr[u].maxv = tr[u].minv = v;
  tr[u].lazy = v;
  tr[u].sum = (long long)(tr[u].r - tr[u].l + 1) * v;
}
void pushdown(int u) {
  eval(u << 1, tr[u].lazy);
  eval(u << 1 | 1, tr[u].lazy);
  tr[u].lazy = 0;
}
void build(int u, int l, int r) {
  if (l == r)
    tr[u] = {l, r, w[r], w[r], w[r], 0};
  else {
    tr[u] = {l, r, 0, 0, 0, 0};
    int mid = l + r >> 1;
    build(u << 1, l, mid);
    build(u << 1 | 1, mid + 1, r);
    pushup(u);
  }
}
void modify(int u, int l, int r, int v) {
  if (tr[u].minv >= v) return;
  if (tr[u].l >= l && tr[u].r <= r && tr[u].maxv < v)
    eval(u, v);
  else {
    if (tr[u].lazy) pushdown(u);
    int mid = tr[u].l + tr[u].r >> 1;
    if (l <= mid) modify(u << 1, l, r, v);
    if (r > mid) modify(u << 1 | 1, l, r, v);
    pushup(u);
  }
}
int query(int u, int l, int r, int &v) {
  if (tr[u].minv > v) return 0;
  if (tr[u].l >= l && tr[u].r <= r && tr[u].sum <= v) {
    v -= tr[u].sum;
    return tr[u].r - tr[u].l + 1;
  } else {
    if (tr[u].lazy) pushdown(u);
    int mid = tr[u].l + tr[u].r >> 1;
    int res = 0;
    if (l <= mid) res = query(u << 1, l, r, v);
    if (r > mid) res += query(u << 1 | 1, l, r, v);
    return res;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  build(1, 1, n);
  while (m--) {
    int op, x, y;
    scanf("%d%d%d", &op, &x, &y);
    if (op == 1)
      modify(1, 1, x, y);
    else
      printf("%d\n", query(1, x, n, y));
  }
  return 0;
}
