#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 5;
const long long maxm = maxn << 3;
long long n, lzy, shu[maxn];
struct sg {
  long long tree[maxm], luzy1[maxm], luzy2[maxm], luzy[maxm];
  inline void pushup(long long x) {
    tree[x] = tree[(x << 1)] + tree[(x << 1 | 1)];
    luzy1[x] = min(luzy1[(x << 1)], luzy1[(x << 1 | 1)]);
    luzy2[x] = max(luzy2[(x << 1)], luzy2[(x << 1 | 1)]);
    return;
  }
  inline void pushdown(long long x, long long l, long long r) {
    if (!luzy[x]) return;
    luzy[(x << 1)] = luzy1[(x << 1)] = luzy2[(x << 1)] = luzy[(x << 1 | 1)] =
        luzy1[(x << 1 | 1)] = luzy2[(x << 1 | 1)] = luzy[x];
    tree[(x << 1)] = (((l + r) >> 1) - l + 1) * luzy[x],
               tree[(x << 1 | 1)] = (r - ((l + r) >> 1)) * luzy[x];
    luzy[x] = 0;
    return;
  }
  void build(long long x, long long l, long long r) {
    if (l == r) {
      tree[x] = luzy1[x] = luzy2[x] = shu[l];
      return;
    }
    build((x << 1), l, ((l + r) >> 1)),
        build((x << 1 | 1), ((l + r) >> 1) + 1, r);
    pushup(x);
    return;
  }
  void add(long long x, long long l, long long r, long long pos,
           long long jia) {
    if (l > pos || luzy1[x] >= jia) return;
    pushdown(x, l, r);
    if (r <= pos && luzy2[x] <= jia) {
      tree[x] = (luzy[x] = luzy1[x] = luzy2[x] = jia) * (r - l + 1);
      return;
    }
    add((x << 1), l, ((l + r) >> 1), pos, jia),
        add((x << 1 | 1), ((l + r) >> 1) + 1, r, pos, jia);
    pushup(x);
    return;
  }
  long long get(long long x, long long l, long long r, long long pos,
                long long &ask) {
    if (r < pos || luzy1[x] > ask) return 0;
    pushdown(x, l, r);
    if (l >= pos && ask >= tree[x]) {
      ask -= tree[x];
      return r - l + 1;
    }
    return get((x << 1), l, ((l + r) >> 1), pos, ask) +
           get((x << 1 | 1), ((l + r) >> 1) + 1, r, pos, ask);
  }
} tree;
signed main() {
  ios::sync_with_stdio(false);
  cin >> n >> lzy;
  for (long long i = 1; i <= n; ++i) cin >> shu[i];
  tree.build(1, 1, n);
  for (long long lzv = 1, opt, x, y; lzv <= lzy; ++lzv) {
    cin >> opt >> x >> y;
    if (opt == 1)
      tree.add(1, 1, n, x, y);
    else
      cout << tree.get(1, 1, n, x, y) << "\n";
  }
}
