#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,mmx,avx,avx2")
using namespace std;
using ll = long long int;
ll taken = 0;
struct Node {
  static constexpr ll unit = 0LL, unit2 = 1e18;
  ll f(ll a, ll b) { return a + b; }
  ll f2(ll a, ll b) { return min(a, b); }
  Node *l = 0, *r = 0;
  int lo, hi, mset = unit;
  ll val = unit, mn = unit2;
  Node(int _lo, int _hi) : lo(_lo), hi(_hi) {}
  Node(vector<ll> &v, int _lo, int _hi) : lo(_lo), hi(_hi) {
    if (lo + 1 < hi) {
      int mid = lo + (hi - lo) / 2;
      l = new Node(v, lo, mid);
      r = new Node(v, mid, hi);
      val = f(l->val, r->val);
      mn = f2(l->mn, r->mn);
    } else
      val = mn = v[lo];
  }
  ll query(int L, int R) {
    if (R <= lo || hi <= L) return unit;
    if (L <= lo && hi <= R) return val;
    push();
    return f(l->query(L, R), r->query(L, R));
  }
  int query_first(int R, int X) {
    if (lo + 1 == hi) return val < X ? lo : -1;
    push();
    int mid = lo + (hi - lo) / 2;
    if (R <= mid) return l->query_first(R, X);
    if (l->mn >= X) return r->query_first(R, X);
    return l->query_first(R, X);
  }
  int query2(int L, int X, ll pref) {
    if (lo + 1 == hi) {
      if (val <= X) taken += val;
      return val <= X;
    }
    push();
    int mid = lo + (hi - lo) / 2;
    if (L >= mid) return r->query2(L, X, pref - l->val);
    if (l->val - pref <= X) {
      taken += l->val - pref;
      return mid - L + r->query2(mid, X + pref - l->val, 0);
    }
    return l->query2(L, X, pref);
  }
  void set(int L, int R, ll x) {
    if (R <= lo || hi <= L) return;
    if (L <= lo && hi <= R) {
      mset = mn = x;
      val = 1LL * (hi - lo) * x;
    } else {
      push(), l->set(L, R, x), r->set(L, R, x);
      val = f(l->val, r->val);
      mn = f2(l->mn, r->mn);
    }
  }
  void push() {
    if (!l) {
      int mid = lo + (hi - lo) / 2;
      l = new Node(lo, mid);
      r = new Node(mid, hi);
    }
    if (mset != unit) l->set(lo, hi, mset), r->set(lo, hi, mset), mset = unit;
  }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  mt19937_64 rng(
      chrono::high_resolution_clock::now().time_since_epoch().count());
  int n, q;
  cin >> n >> q;
  vector<ll> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  Node *tr = new Node(v, 0, n);
  vector<array<ll, 2>> intervals;
  for (int i = 0; i < n;) {
    int j = i;
    while (j < n && v[i] == v[j]) ++j;
    intervals.push_back({i, v[i]});
    i = j;
  }
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      int x, y;
      cin >> x >> y;
      --x;
      int left = tr->query_first(x + 1, y);
      if (left != -1) tr->set(left, x + 1, y);
    } else {
      int x, y;
      cin >> x >> y;
      --x;
      int ans = 0, rt = x;
      do {
        taken = 0;
        int len = tr->query2(x, y, tr->query(0, x));
        ans += len;
        rt = x + len;
        y -= taken;
        x = tr->query_first(n, y + 1);
      } while (x >= rt && y > 0);
      cout << ans << '\n';
    }
  }
}
