#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 5;
int n, m;
long long d[N << 2];
int tag[N << 2], mx[N << 2], mn[N << 2];
inline void pushdown(int o, int len) {
  if (int& x = tag[o]) {
    tag[o << 1] = tag[o << 1 | 1] = x;
    d[o << 1] = (long long)x * ((len + 1) / 2);
    d[o << 1 | 1] = (long long)x * (len / 2);
    mx[o << 1] = mx[o << 1 | 1] = mn[o << 1] = mn[o << 1 | 1] = x;
    x = 0;
  }
}
void build(int l, int r, int o) {
  if (l == r)
    cin >> mx[o], d[o] = mn[o] = mx[o];
  else {
    const int mid = (l + r) / 2;
    build(l, mid, o << 1), build(mid + 1, r, o << 1 | 1);
    d[o] = d[o << 1] + d[o << 1 | 1];
    mx[o] = max(mx[o << 1], mx[o << 1 | 1]);
    mn[o] = min(mn[o << 1], mn[o << 1 | 1]);
  }
}
void modify(int l, int r, int o, const int& L, const int& R, const int& v) {
  if (mn[o] >= v) return;
  if (L <= l && r <= R) {
    if (mx[o] <= v) {
      mx[o] = mn[o] = v;
      d[o] = (r - l + 1LL) * v;
      tag[o] = v;
      return;
    }
  }
  pushdown(o, r - l + 1);
  const int mid = (l + r) / 2;
  if (L <= mid) modify(l, mid, o << 1, L, R, v);
  if (mid < R) modify(mid + 1, r, o << 1 | 1, L, R, v);
  d[o] = d[o << 1] + d[o << 1 | 1];
  mx[o] = max(mx[o << 1], mx[o << 1 | 1]);
  mn[o] = min(mn[o << 1], mn[o << 1 | 1]);
}
long long query(int l, int r, int o, const int& L, const int& R) {
  if (L <= l && r <= R) return d[o];
  pushdown(o, r - l + 1);
  const int mid = (l + r) / 2;
  long long res = 0;
  if (L <= mid) res = query(l, mid, o << 1, L, R);
  if (mid < R) res += query(mid + 1, r, o << 1 | 1, L, R);
  return res;
}
int find(int l, int r, int o, const int& L, const int& v) {
  if (l == r) return l;
  pushdown(o, r - l + 1);
  const int mid = (l + r) / 2;
  if (L <= mid && v >= mn[o << 1]) return find(l, mid, o << 1, L, v);
  return find(mid + 1, r, o << 1 | 1, L, v);
}
int find0(int l, int r, int o, const long long& v) {
  if (l == r) return v >= d[o] ? l + 1 : l;
  pushdown(o, r - l + 1);
  const int mid = (l + r) / 2;
  if (v >= d[o << 1]) return find0(mid + 1, r, o << 1 | 1, v - d[o << 1]);
  return find0(l, mid, o << 1, v);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  build(1, n, 1);
  while (m--) {
    int op, x, y;
    cin >> op >> x >> y;
    if (op == 1)
      modify(1, n, 1, 1, x, y);
    else {
      int ans = 0;
      while (x <= n && y >= mn[1]) {
        int t = find(1, n, 1, x, y);
        x = t;
        long long pr = x == 1 ? 0 : query(1, n, 1, 1, x - 1);
        t = find0(1, n, 1, pr + y);
        ans += t - x;
        y -= query(1, n, 1, x, t - 1);
        x = t;
      }
      cout << ans << '\n';
    }
  }
  return 0;
}
