#include <bits/stdc++.h>
const long long N = 2e5 + 5;
long long n, m;
long long read(long long x = 0, long long f = 0, char ch = getchar()) {
  while ('0' > ch or ch > '9') f = ch == '-', ch = getchar();
  while ('0' <= ch and ch <= '9') x = x * 10 + (ch ^ 48), ch = getchar();
  return f ? -x : x;
}
struct Segment_Tree {
  long long sum[N << 2], min[N << 2], max[N << 2], tag[N << 2];
  void push_up(long long p) {
    sum[p] = sum[(p << 1)] + sum[(p << 1 | 1)];
    max[p] = std::max(max[(p << 1)], max[(p << 1 | 1)]);
    min[p] = std::min(min[(p << 1)], min[(p << 1 | 1)]);
  }
  void push_down(long long p, long long l, long long r) {
    if (tag[p]) {
      tag[(p << 1)] = tag[(p << 1 | 1)] = tag[p];
      min[(p << 1)] = max[(p << 1)] = min[(p << 1 | 1)] = max[(p << 1 | 1)] =
          tag[p];
      sum[(p << 1)] = tag[p] * (((l + r) >> 1) - l + 1);
      sum[(p << 1 | 1)] = tag[p] * (r - ((l + r) >> 1));
      tag[p] = 0;
    }
  }
  void build(long long p, long long l, long long r) {
    if (l == r) return sum[p] = max[p] = min[p] = read(), void();
    build((p << 1), l, ((l + r) >> 1)),
        build((p << 1 | 1), ((l + r) >> 1) + 1, r), push_up(p);
  }
  void modify(long long p, long long l, long long r, long long x, long long y,
              long long val) {
    if (l == x and r == y and max[p] <= val)
      return tag[p] = max[p] = min[p] = val, sum[p] = val * (r - l + 1), void();
    push_down(p, l, r);
    if (x <= ((l + r) >> 1) and min[(p << 1)] < val)
      modify((p << 1), l, ((l + r) >> 1), x, std::min(y, ((l + r) >> 1)), val);
    if (((l + r) >> 1) < y and min[(p << 1 | 1)] < val)
      modify((p << 1 | 1), ((l + r) >> 1) + 1, r,
             std::max(((l + r) >> 1) + 1, x), y, val);
    push_up(p);
  }
  long long query(long long p, long long l, long long r, long long x,
                  long long y, long long &val) {
    if (l == x and r == y and sum[p] <= val) return val -= sum[p], r - l + 1;
    push_down(p, l, r);
    long long res = 0;
    if (x <= ((l + r) >> 1) and min[(p << 1)] <= val)
      res += query((p << 1), l, ((l + r) >> 1), x, std::min(y, ((l + r) >> 1)),
                   val);
    if (((l + r) >> 1) < y and min[(p << 1 | 1)] <= val)
      res += query((p << 1 | 1), ((l + r) >> 1) + 1, r,
                   std::max(((l + r) >> 1) + 1, x), y, val);
    return res;
  }
} T;
signed main() {
  memset(T.min, 0x3f, sizeof T.min);
  n = read(), m = read(), T.build(1, 1, n);
  for (long long opt, x, y; m--;) {
    opt = read(), x = read(), y = read();
    if (opt == 1)
      T.modify(1, 1, n, 1, x, y);
    else
      printf("%lld\n", T.query(1, 1, n, x, n, y));
  }
  return 0;
}
