#include <bits/stdc++.h>
using namespace std;
const int cs = 2 * 1e5 + 10;
long long mn[4 * cs], mx[4 * cs], t[4 * cs], cnt[4 * cs], lzy[4 * cs], a[cs], n;
void merge(int ind) {
  mn[ind] = min(mn[ind << 1], mn[ind << 1 | 1]);
  mx[ind] = max(mx[ind << 1], mx[ind << 1 | 1]);
  t[ind] = t[ind << 1] + t[ind << 1 | 1];
}
void transfer(int ind, int l, int r) {
  if (l != r) {
    mn[ind << 1] = mx[ind << 1] = lzy[ind << 1] = lzy[ind];
    t[ind << 1] = cnt[ind << 1] * lzy[ind];
    mn[ind << 1 | 1] = mx[ind << 1 | 1] = lzy[ind << 1 | 1] = lzy[ind];
    t[ind << 1 | 1] = cnt[ind << 1 | 1] * lzy[ind];
  }
  lzy[ind] = 0;
}
void build(long long ind, long long l, long long r) {
  if (l == r) {
    mn[ind] = mx[ind] = t[ind] = a[l];
    cnt[ind] = 1;
  } else {
    build(ind << 1, l, ((l + r) >> 1));
    build(ind << 1 | 1, ((l + r) >> 1) + 1, r);
    merge(ind);
    cnt[ind] = cnt[ind << 1] + cnt[ind << 1 | 1];
  }
}
void update(long long ind, long long ql, long long qr, long long l, long long r,
            long long val) {
  if (lzy[ind]) transfer(ind, l, r);
  if (l > qr || r < ql || val == 0 || mn[ind] >= val)
    return;
  else if (l >= ql && r <= qr && mx[ind] <= val)
    t[ind] = cnt[ind] * val, mn[ind] = mx[ind] = lzy[ind] = val;
  else
    update(ind << 1, ql, qr, l, ((l + r) >> 1), val),
        update(ind << 1 | 1, ql, qr, ((l + r) >> 1) + 1, r, val), merge(ind);
}
long long query(long long ind, long long ql, long long qr, long long l,
                long long r, long long &val) {
  if (lzy[ind]) transfer(ind, l, r);
  if (l > qr || r < ql || val == 0 || mn[ind] > val)
    return 0ll;
  else if (l >= ql && r <= qr && t[ind] <= val) {
    val -= t[ind];
    return cnt[ind];
  } else
    return query(ind << 1, ql, qr, l, ((l + r) >> 1), val) +
           query(ind << 1 | 1, ql, qr, ((l + r) >> 1) + 1, r, val);
}
int main() {
  long long q, t, x, y;
  cin >> n >> q;
  for (int i = 1; i < n + 1; i++) cin >> a[i];
  build(1, 1, n);
  while (q--) {
    cin >> t >> x >> y;
    if (t == 1)
      update(1, 1, x, 1, n, y);
    else
      cout << query(1, x, n, 1, n, y) << endl;
  }
}
