#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
long long sum[maxn << 2], lazy[maxn << 2], a[maxn];
long long maxs[maxn << 2], len[maxn << 2], mins[maxn << 2];
void push_up(int id) {
  sum[id] = sum[(id << 1)] + sum[(id << 1 | 1)];
  maxs[id] = max(maxs[(id << 1)], maxs[(id << 1 | 1)]);
  mins[id] = min(mins[(id << 1)], mins[(id << 1 | 1)]);
}
void build(int id, int l, int r) {
  len[id] = r - l + 1;
  if (l == r) {
    mins[id] = maxs[id] = sum[id] = a[l];
    return;
  }
  int mid = (l + r) >> 1;
  build((id << 1), l, mid);
  build((id << 1 | 1), mid + 1, r);
  push_up(id);
}
void push_down(int id) {
  if (!lazy[id]) return;
  sum[(id << 1 | 1)] = lazy[id] * len[(id << 1 | 1)];
  sum[(id << 1)] = lazy[id] * len[(id << 1)];
  maxs[(id << 1 | 1)] = maxs[(id << 1)] = lazy[id];
  mins[(id << 1 | 1)] = mins[(id << 1)] = lazy[id];
  lazy[(id << 1)] = lazy[(id << 1 | 1)] = lazy[id];
  lazy[id] = 0;
}
void update(int id, int l, int r, int x, int y, int v) {
  if (x <= l && y >= r) {
    sum[id] = v * len[id];
    lazy[id] = v, maxs[id] = v, mins[id] = v;
    return;
  }
  push_down(id);
  int mid = (l + r) >> 1;
  if (x <= mid) update((id << 1), l, mid, x, y, v);
  if (y > mid) update((id << 1 | 1), mid + 1, r, x, y, v);
  push_up(id);
}
int queryL(int id, int l, int r, int x, int y, int v) {
  if (y < l || x > r) return 0x3f3f3f3f;
  if (l == r) return l;
  int mid = (l + r) >> 1;
  push_down(id);
  if (x <= mid && mins[(id << 1)] <= v)
    return queryL((id << 1), l, mid, x, y, v);
  else if (y > mid && mins[(id << 1 | 1)] <= v)
    return queryL((id << 1 | 1), mid + 1, r, x, y, v);
  else
    return 0x3f3f3f3f;
}
long long querySum(int id, int l, int r, int x, int y) {
  if (y < l || x > r) return 0;
  if (x <= l && y >= r) return sum[id];
  long long ans = 0;
  push_down(id);
  int mid = (l + r) >> 1;
  if (x <= mid) ans += querySum((id << 1), l, mid, x, y);
  if (y > mid) ans += querySum((id << 1 | 1), mid + 1, r, x, y);
  return ans;
}
int queryR(int id, int l, int r, int x, int y, long long s, long long pre,
           long long now) {
  if (x <= l && y >= r && sum[id] + now - pre <= s) {
    return r;
  }
  int mid = (l + r) >> 1;
  push_down(id);
  if (y > mid && maxs[(id << 1 | 1)] <= s + pre - sum[(id << 1)] - now)
    return queryR((id << 1 | 1), mid + 1, r, x, y, s, pre,
                  now + sum[(id << 1)]);
  else if (x <= mid)
    return queryR((id << 1), l, mid, x, y, s, pre, now);
  else
    return 0x3f3f3f3f;
}
void query(int id, int l, int r, int x, int y, int &s, int &ans) {
  if (y < l || x > r) return;
  if (x <= l && y >= r) {
    ans += len[id];
    s -= sum[id];
    return;
  }
  int mid = (l + r) >> 1;
  push_down(id);
  if (x <= mid) query((id << 1), l, mid, x, y, s, ans);
  if (y > mid) query((id << 1 | 1), mid + 1, r, x, y, s, ans);
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  build(1, 1, n);
  while (q--) {
    int op, x, y;
    scanf("%d%d%d", &op, &x, &y);
    if (op == 1) {
      int pos = queryL(1, 1, n, 1, x, y);
      if (pos <= x) update(1, 1, n, pos, x, y);
    } else {
      int ans = 0;
      while (true) {
        int pos = queryL(1, 1, n, x, n, y);
        if (pos > n) break;
        long long s = querySum(1, 1, n, 1, pos - 1);
        int r = queryR(1, 1, n, pos, n, y, s, 0);
        query(1, 1, n, pos, r, y, ans);
        x = r + 1;
        if (!y) break;
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
