#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
using namespace std;
double getTime() { return clock() / (double)CLOCKS_PER_SEC; };
const int mod = 1e9 + 7;
const long long INF = 3e18;
const int N = 2e5 + 5;
const int P0 = 437;
const int P1 = 343;
const int d = 400;
struct node {
  int mi, ma, gift;
  long long sum;
  node() {
    mi = gift = mod;
    ma = -mod;
    sum = 0;
  }
};
vector<int> a;
int n, q;
vector<node> tree;
void Push(int v, int L, int R) {
  if (tree[v].gift == mod) return;
  int c = (L + R) / 2;
  tree[v * 2].mi = tree[v * 2].ma = tree[v * 2 + 1].mi = tree[v * 2 + 1].ma =
      tree[v * 2].gift = tree[v * 2 + 1].gift = tree[v].gift;
  tree[v * 2].sum = (long long)(c - L) * tree[v].gift;
  tree[v * 2 + 1].sum = (long long)(R - c) * tree[v].gift;
  tree[v].gift = mod;
}
int F_smaller(int v, int L, int R, int k) {
  if (R - L == 1) {
    if (tree[v].mi > k) return L + 1;
    return L;
  }
  Push(v, L, R);
  int c = (L + R) / 2;
  if (tree[v * 2].mi > k) {
    if (tree[v * 2 + 1].mi > k) return -1;
    return F_smaller(v * 2 + 1, c, R, k);
  }
  return F_smaller(v * 2, L, c, k);
}
long long Get_sum(int v, int L, int R, int l, int r) {
  if (L == l && R == r) return tree[v].sum;
  Push(v, L, R);
  int c = (L + R) / 2;
  long long an = 0;
  if (l < c) an += Get_sum(v * 2, L, c, l, min(r, c));
  if (c < r) an += Get_sum(v * 2 + 1, c, R, max(l, c), r);
  return an;
}
int F_right(int v, int L, int R, int Le, long long k, long long cur_sum) {
  if (R - L == 1) {
    if (tree[v].sum <= k) return L + 1;
    return L;
  }
  Push(v, L, R);
  int c = (L + R) / 2;
  if (Le >= c)
    return F_right(v * 2 + 1, c, R, Le, k, cur_sum - tree[v * 2].sum);
  if (Le > L) {
    long long Sleft = tree[v * 2].sum - cur_sum;
    if (Sleft <= k) return F_right(v * 2 + 1, c, R, Le, k - Sleft, cur_sum);
    return F_right(v * 2, L, c, Le, k, cur_sum);
  }
  if (tree[v * 2].sum <= k)
    return F_right(v * 2 + 1, c, R, Le, k - tree[v * 2].sum, cur_sum);
  return F_right(v * 2, L, c, Le, k, cur_sum);
}
void Upd(int v, int L, int R, int l, int r, int nmax) {
  if (L == l && R == r) {
    tree[v].mi = tree[v].ma = tree[v].gift = nmax;
    tree[v].sum = (long long)(R - L) * nmax;
    return;
  }
  Push(v, L, R);
  int c = (L + R) / 2;
  if (l < c) Upd(v * 2, L, c, l, min(r, c), nmax);
  if (c < r) Upd(v * 2 + 1, c, R, max(l, c), r, nmax);
  tree[v].sum = tree[v * 2].sum + tree[v * 2 + 1].sum;
  tree[v].mi = tree[v * 2 + 1].mi;
  tree[v].ma = tree[v * 2].ma;
}
void Update(int x, int nmax) {
  int pos = F_smaller(1, 0, n, nmax);
  if (pos == -1 || pos > x) return;
  Upd(1, 0, n, pos, x + 1, nmax);
}
void solve() {
  cin >> n >> q;
  a.resize(n);
  tree.resize(n * 4);
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
  }
  for (int i = 0; i < (n); i++) Upd(1, 0, n, i, i + 1, a[i]);
  for (int i = 0; i < (q); i++) {
    long long t, x, y;
    cin >> t >> x >> y;
    x--;
    if (t == 1)
      Update(x, y);
    else {
      int cnt = 0;
      while (true) {
        long long pos = F_smaller(1, 0, n, y);
        if (pos == -1 || pos == n) break;
        pos = max(pos, x);
        long long Csum = 0;
        if (pos) Csum = Get_sum(1, 0, n, 0, pos);
        int R = F_right(1, 0, n, pos, y, Csum);
        cnt += R - pos;
        y -= Get_sum(1, 0, n, pos, R);
        pos = R;
        if (pos == n) break;
      }
      cout << cnt << '\n';
    }
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int qq = 1;
  while (qq--) solve();
}
