#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
struct node {
  long long mi, val, lazy;
} t[N << 2];
long long a[N], n, q;
void build(long long pos, long long l, long long r) {
  if (l == r) {
    t[pos] = {a[l], a[l], 0};
    return;
  }
  long long mid = (l + r) >> 1;
  build(pos << 1, l, mid);
  build(pos << 1 | 1, mid + 1, r);
  t[pos].mi = min(t[pos << 1].mi, t[pos << 1 | 1].mi);
  t[pos].val = t[pos << 1].val + t[pos << 1 | 1].val;
}
void lazydown(long long pos, long long l, long long r) {
  if (!t[pos].lazy) return;
  t[pos].mi = t[pos].lazy;
  t[pos].val = (r - l + 1) * t[pos].lazy;
  if (l != r)
    t[pos << 1].lazy = t[pos].lazy, t[pos << 1 | 1].lazy = t[pos].lazy;
  t[pos].lazy = 0;
}
void update(long long pos, long long l, long long r, long long u, long long v,
            long long y) {
  lazydown(pos, l, r);
  if (l > v || r < u) return;
  if (u <= l && r <= v) {
    t[pos].lazy = y;
    lazydown(pos, l, r);
    return;
  }
  long long mid = (l + r) >> 1;
  update(pos << 1, l, mid, u, v, y);
  update(pos << 1 | 1, mid + 1, r, u, v, y);
  t[pos].mi = min(t[pos << 1].mi, t[pos << 1 | 1].mi);
  t[pos].val = t[pos << 1].val + t[pos << 1 | 1].val;
}
long long query(long long pos, long long l, long long r, long long u,
                long long v) {
  lazydown(pos, l, r);
  if (l > v || r < u) return 0;
  if (u <= l && r <= v) return t[pos].val;
  long long mid = (l + r) >> 1;
  long long leaf1 = query(pos << 1, l, mid, u, v);
  long long leaf2 = query(pos << 1 | 1, mid + 1, r, u, v);
  return leaf1 + leaf2;
}
long long cal(long long pos, long long l, long long r, long long u, long long v,
              long long &y) {
  lazydown(pos, l, r);
  if (l > v || r < u || l > r) return 0;
  if (t[pos].mi > y) return 0;
  if (u <= l && r <= v && y >= t[pos].val) {
    y -= t[pos].val;
    return r - l + 1;
  }
  if (l == r) return 0;
  long long mid = (l + r) >> 1;
  long long leaf1 = cal(pos << 1, l, mid, u, v, y);
  long long leaf2 = cal(pos << 1 | 1, mid + 1, r, u, v, y);
  return leaf1 + leaf2;
}
signed main() {
  cin >> n >> q;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  long long check = n * n * q;
  build(1, 1, n);
  while (q--) {
    long long T, x, y;
    cin >> T >> x >> y;
    if (T == 1) {
      long long l = 1, r = x, res = 0x3f3f3f3f;
      while (l <= r) {
        long long mid = (l + r) >> 1;
        long long val = query(1, 1, n, mid, mid);
        if (val <= y) {
          r = mid - 1;
          res = min(res, mid);
          continue;
        }
        l = mid + 1;
      }
      if (res == 0x3f3f3f3f) continue;
      update(1, 1, n, res, x, y);
      continue;
    }
    cout << cal(1, 1, n, x, n, y) << "\n";
  }
  return 0;
}
