#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 7;
int n, q, e, ans;
long long a[N], f[N], g[N], tg[N];
inline void build(int l, int r, int t) {
  tg[t] = -1;
  if (l == r) {
    f[t] += a[l], g[t] += a[l];
    return;
  }
  int d = (l + r) >> 1;
  build(l, d, t << 1), build(d + 1, r, t << 1 | 1);
  f[t] = f[t << 1] + f[t << 1 | 1], g[t] = min(g[t << 1], g[t << 1 | 1]);
}
inline void cover(int ql, int qr, int t, int l, int r, int c) {
  int d = (l + r) >> 1;
  if (tg[t] != -1) {
    tg[t << 1] = tg[t], tg[t << 1 | 1] = tg[t];
    g[t << 1] = tg[t], g[t << 1 | 1] = tg[t];
    f[t << 1] = (d - l + 1) * tg[t], f[t << 1 | 1] = (r - d) * tg[t],
           tg[t] = -1;
  }
  if (l == ql && r == qr) {
    tg[t] = c, f[t] = 1ll * (r - l + 1) * c, g[t] = c;
    return;
  }
  if (ql <= d) cover(ql, min(d, qr), t << 1, l, d, c);
  if (d + 1 <= qr) cover(max(d + 1, ql), qr, t << 1 | 1, d + 1, r, c);
  g[t] = min(g[t << 1], g[t << 1 | 1]);
  f[t] = f[t << 1] + f[t << 1 | 1];
}
inline int getans(int l, int r, int t, int x) {
  int d = (l + r) >> 1;
  if (tg[t] != -1) {
    tg[t << 1] = tg[t], tg[t << 1 | 1] = tg[t];
    g[t << 1] = tg[t], g[t << 1 | 1] = tg[t];
    f[t << 1] = (d - l + 1) * tg[t], f[t << 1 | 1] = (r - d) * tg[t],
           tg[t] = -1;
  }
  if (l == r) return g[t];
  if (x <= d) return getans(l, d, t << 1, x);
  if (d + 1 <= x) getans(d + 1, r, t << 1 | 1, x);
}
inline void getsum(int ql, int qr, int t, int l, int r) {
  int d = (l + r) >> 1;
  if (tg[t] != -1) {
    tg[t << 1] = tg[t], tg[t << 1 | 1] = tg[t];
    g[t << 1] = tg[t], g[t << 1 | 1] = tg[t];
    f[t << 1] = (d - l + 1) * tg[t], f[t << 1 | 1] = (r - d) * tg[t],
           tg[t] = -1;
  }
  if (ql == l && qr == r) {
    if (f[t] <= e) {
      e -= f[t], ans += (r - l + 1);
      return;
    }
    if (l == r) return;
    if (g[t << 1] <= e) getsum(l, d, t << 1, l, d);
    if (g[t << 1 | 1] <= e) getsum(d + 1, r, t << 1 | 1, d + 1, r);
    return;
  }
  if (ql <= d) getsum(ql, min(d, qr), t << 1, l, d);
  if (d + 1 <= qr) getsum(max(d + 1, ql), qr, t << 1 | 1, d + 1, r);
}
int main() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  build(1, n, 1);
  while (q--) {
    int t, x, y;
    scanf("%d%d%d", &t, &x, &y);
    if (t == 1) {
      int l = 1, r = x - 1, p = x;
      if (getans(1, n, 1, x) >= y) continue;
      while (l <= r) {
        int d = (l + r) >> 1;
        if (getans(1, n, 1, d) < y)
          p = d, r = d - 1;
        else
          l = d + 1;
      }
      cover(p, x, 1, 1, n, y);
    } else {
      ans = 0, e = y;
      getsum(x, n, 1, 1, n);
      printf("%d\n", ans);
    }
  }
}
