#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int N = 2e5 + 10;
const long long mod = 1e9 + 7;
const long long mod2 = 998244353;
const long long inf = 1e18;
const int LOG = 22;
long long pw(long long a, long long b, long long M) {
  return (!b ? 1
             : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M
                      : pw(a * a % M, b / 2, M)));
}
long long sum[4 * N], lz[4 * N], seg[4 * N], A[N], rem;
void B(int v, int tl, int tr) {
  lz[v] = -1;
  if (tl == tr) {
    seg[v] = sum[v] = A[tl];
    return;
  }
  int mid = (tl + tr) >> 1;
  B(v << 1, tl, mid);
  B(v << 1 | 1, mid + 1, tr);
  seg[v] = min(seg[v << 1], seg[v << 1 | 1]);
  sum[v] = sum[v << 1] + sum[v << 1 | 1];
}
void second(int v, int tl, int tr) {
  if (lz[v] == -1 || tl == tr) return;
  int mid = (tl + tr) >> 1;
  lz[v << 1] = lz[v];
  lz[v << 1 | 1] = lz[v];
  seg[v << 1] = lz[v];
  seg[v << 1 | 1] = lz[v];
  sum[v << 1] = 1ll * (mid - tl + 1) * lz[v];
  sum[v << 1 | 1] = 1ll * (tr - mid) * lz[v];
  lz[v] = -1;
}
void U(int v, int tl, int tr, int l, int r, long long x) {
  second(v, tl, tr);
  if (l > r || l > tr || r < tl) return;
  if (l <= tl && tr <= r) {
    seg[v] = x;
    lz[v] = x;
    sum[v] = lz[v] * (tr - tl + 1);
    return;
  }
  int mid = (tl + tr) >> 1;
  U(v << 1, tl, mid, l, r, x);
  U(v << 1 | 1, mid + 1, tr, l, r, x);
  seg[v] = min(seg[v << 1], seg[v << 1 | 1]);
  sum[v] = sum[v << 1] + sum[v << 1 | 1];
}
long long Find(int v, int tl, int tr, int l, int r, long long x) {
  second(v, tl, tr);
  if (l > r || l > tr || r < tl || seg[v] >= x) return inf;
  if (tl == tr) {
    return tl;
  }
  int mid = (tl + tr) >> 1;
  long long now = Find(v << 1, tl, mid, l, r, x);
  if (now != inf) return now;
  return Find(v << 1 | 1, mid + 1, tr, l, r, x);
}
int G(int v, int tl, int tr, int l, int r) {
  second(v, tl, tr);
  if (l > tr || r < tl || seg[v] > rem) return 0;
  if (l <= tl && tr <= r && sum[v] <= rem) {
    rem -= sum[v];
    return (tr - tl + 1);
  }
  int mid = (tl + tr) >> 1;
  return G(v << 1, tl, mid, l, r) + G(v << 1 | 1, mid + 1, tr, l, r);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
  }
  B(1, 1, n);
  while (q--) {
    int ver;
    cin >> ver;
    if (ver == 1) {
      long long l = 1, r, x;
      cin >> r >> x;
      long long ans = Find(1, 1, n, l, r, x);
      if (ans > r) continue;
      U(1, 1, n, ans, r, x);
    } else {
      long long l;
      cin >> l >> rem;
      cout << G(1, 1, n, l, n) << "\n";
    }
  }
  return 0;
}
