#include <bits/stdc++.h>
using namespace std;
const int maxn = 200200;
int a[maxn];
long long sum[maxn * 4], mn[maxn * 4], laz[maxn * 4];
void build(int l, int r, int rt) {
  if (l == r) {
    sum[rt] = mn[rt] = a[l];
    return;
  }
  int mid = (l + r) / 2;
  build(l, mid, rt << 1);
  build(mid + 1, r, rt << 1 | 1);
  mn[rt] = mn[rt << 1 | 1];
  sum[rt] = sum[rt << 1] + sum[rt << 1 | 1];
}
void pushdown(int l, int r, int rt) {
  if (laz[rt]) {
    int mid = (l + r) / 2;
    mn[rt << 1] = mn[rt << 1 | 1] = laz[rt << 1] = laz[rt << 1 | 1] = laz[rt];
    sum[rt << 1] = (mid - l + 1) * (long long)laz[rt];
    sum[rt << 1 | 1] = (r - mid) * (long long)laz[rt];
    laz[rt] = 0;
  }
}
void upd(int L, int R, int v, int l, int r, int rt) {
  if (L <= l && r <= R) {
    if (mn[rt] >= v) return;
    if (l == r) {
      sum[rt] = v * (long long)(r - l + 1);
      mn[rt] = v;
      laz[rt] = v;
      return;
    }
    pushdown(l, r, rt);
    int mid = (l + r) / 2;
    if (mn[rt << 1] <= v) {
      sum[rt << 1 | 1] = v * (long long)(r - mid);
      mn[rt << 1 | 1] = v;
      laz[rt << 1 | 1] = v;
      upd(L, R, v, l, mid, rt << 1);
    } else {
      upd(L, R, v, mid + 1, r, rt << 1 | 1);
    }
    sum[rt] = sum[rt << 1] + sum[rt << 1 | 1];
    mn[rt] = mn[rt << 1 | 1];
    return;
  }
  pushdown(l, r, rt);
  int mid = (l + r) / 2;
  if (L <= mid) upd(L, R, v, l, mid, rt << 1);
  if (mid < R) upd(L, R, v, mid + 1, r, rt << 1 | 1);
  sum[rt] = sum[rt << 1] + sum[rt << 1 | 1];
  mn[rt] = mn[rt << 1 | 1];
}
long long ask(int L, int& v, int l, int r, int rt) {
  if (L <= l) {
    if (sum[rt] <= v) {
      v -= sum[rt];
      return r - l + 1;
    }
    if (mn[rt] > v) {
      return 0;
    }
    if (l == r) return 0;
    int mid = (l + r) / 2;
    pushdown(l, r, rt);
    long long ans = ask(L, v, l, mid, rt << 1);
    ans += ask(L, v, mid + 1, r, rt << 1 | 1);
    return ans;
  }
  int mid = (l + r) / 2;
  pushdown(l, r, rt);
  long long ans = 0;
  if (L <= mid) ans += ask(L, v, l, mid, rt << 1);
  ans += ask(L, v, mid + 1, r, rt << 1 | 1);
  return ans;
}
int main(void) {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  build(1, n, 1);
  for (int i = 0; i < q; i++) {
    int t, x, y;
    scanf("%d%d%d", &t, &x, &y);
    if (t == 1) {
      upd(1, x, y, 1, n, 1);
    } else {
      long long ans = ask(x, y, 1, n, 1);
      printf("%lld\n", ans);
    }
  }
  return 0;
}
