#include <bits/stdc++.h>
using namespace std;
const int base = 13331;
const int MOD = 1e9 + 7;
const int MOD1 = 998244353;
const int mod = 65536;
const long long INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int N = 2e5 + 10, M = 20000010;
const int NN = 3e5 + 10;
inline long long read() {
  char ch = getchar();
  long long f = 1, first = 0;
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    first = first * 10 + ch - '0';
    ch = getchar();
  }
  return first * f;
}
int a[N];
int op, first, second, cnt;
long long tr[N << 2], lz[N << 2], mn[N << 2];
void up(int o) {
  tr[o] = tr[(o << 1)] + tr[(o << 1 | 1)];
  mn[o] = min(mn[(o << 1)], mn[(o << 1 | 1)]);
}
void build(int o, int l, int r) {
  if (l == r) {
    tr[o] = mn[o] = a[l];
    return;
  }
  int mid = l + r >> 1;
  build((o << 1), l, mid);
  build((o << 1 | 1), mid + 1, r);
  up(o);
}
void pushdown(int o, int l, int r) {
  int mid = l + r >> 1;
  if (lz[o]) {
    tr[(o << 1)] = 1ll * (mid - l + 1) * lz[o];
    tr[(o << 1 | 1)] = 1ll * (r - mid) * lz[o];
    lz[(o << 1)] = lz[(o << 1 | 1)] = mn[(o << 1)] = mn[(o << 1 | 1)] = lz[o];
    lz[o] = 0;
  }
}
int qry_pos(int o, int l, int r, int first, int v) {
  if (mn[o] >= v) return -1;
  if (l == r) {
    if (l <= first)
      return l;
    else
      return -1;
  }
  int mid = l + r >> 1;
  pushdown(o, l, r);
  if (first <= mid)
    return qry_pos((o << 1), l, mid, first, v);
  else {
    if (mn[(o << 1)] < v)
      return qry_pos((o << 1), l, mid, first, v);
    else
      return qry_pos((o << 1 | 1), mid + 1, r, first, v);
  }
}
void upd(int o, int l, int r, int ql, int qr, int v) {
  if (ql > qr) return;
  if (ql <= l && r <= qr) {
    tr[o] = 1ll * (r - l + 1) * v;
    mn[o] = lz[o] = v;
    return;
  }
  int mid = l + r >> 1;
  pushdown(o, l, r);
  if (ql <= mid) upd((o << 1), l, mid, ql, qr, v);
  if (mid < qr) upd((o << 1 | 1), mid + 1, r, ql, qr, v);
  up(o);
}
void qry(int o, int l, int r, int pos) {
  if (l >= pos && tr[o] <= second) {
    cnt += r - l + 1;
    second -= tr[o];
    return;
  }
  if (l == r) {
    if (l >= pos && tr[o] <= second) {
      second -= tr[o];
      cnt++;
    }
    return;
  }
  int mid = l + r >> 1;
  pushdown(o, l, r);
  if (pos <= mid && mn[(o << 1)] <= second) qry((o << 1), l, mid, pos);
  if (mn[(o << 1 | 1)] > second) return;
  qry((o << 1 | 1), mid + 1, r, pos);
}
void debug(int o, int l, int r) {
  if (l == r) {
    cout << tr[o] << " ";
    return;
  }
  int mid = l + r >> 1;
  pushdown(o, l, r);
  debug((o << 1), l, mid);
  debug((o << 1 | 1), mid + 1, r);
  up(o);
}
int main() {
  int n = read(), q = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  build(1, 1, n);
  while (q--) {
    op = read(), first = read(), second = read();
    if (op == 1) {
      int pos = qry_pos(1, 1, n, first, second);
      if (pos == -1) continue;
      upd(1, 1, n, pos, first, second);
    } else {
      cnt = 0;
      qry(1, 1, n, first);
      printf("%d\n", cnt);
    }
  }
  return 0;
}
