#include <bits/stdc++.h>
using namespace std;
const string yno[2] = {"NO\n", "YES\n"};
int la[2000005 * 4], mn[2000005 * 4], mx[2000005 * 4];
long long f[2000005 * 4];
int a[2000005], n;
void check(int k, int l, int r, int t) {
  if (l > r) return;
  la[k] = max(la[k], t);
  if (la[k] >= mx[k]) {
    f[k] = 1ll * la[k] * (r - l + 1);
    mn[k] = la[k];
    mx[k] = la[k];
  }
}
void down(int k, int l, int r) {
  if (la[k] == 0) return;
  if (l >= r) return;
  int m = (l + r) >> 1;
  check(k << 1, l, m, la[k]);
  check((k << 1) | 1, m + 1, r, la[k]);
  la[k] = 0;
}
void pup(int k) {
  f[k] = f[(k << 1)] + f[(k << 1) + 1];
  mn[k] = min(mn[(k << 1)], mn[(k << 1) | 1]);
  mx[k] = max(mx[(k << 1)], mx[(k << 1) | 1]);
}
void build(int k, int l, int r) {
  if (l > r) return;
  if (l == r) {
    f[k] = a[l];
    mn[k] = a[l];
    mx[k] = a[l];
    return;
  }
  int m = (l + r) >> 1;
  build((k << 1), l, m);
  build((k << 1) + 1, m + 1, r);
  pup(k);
}
void up(int k, int u, int v, int l, int r, int val) {
  if (u > r || v < l) return;
  if (u <= l && r <= v) {
    la[k] = max(la[k], val);
    if (la[k] >= mx[k]) {
      f[k] = 1ll * (r - l + 1) * la[k];
      mn[k] = la[k];
      mx[k] = la[k];
      return;
    }
    if (la[k] <= mn[k]) {
      return;
    }
  }
  down(k, l, r);
  int m = (l + r) >> 1;
  up((k << 1), u, v, l, m, val);
  up((k << 1) | 1, u, v, m + 1, r, val);
  pup(k);
}
int get(int k, int u, int v, int l, int r, int &val) {
  if (val <= 0 || u > r || v < l) return 0;
  if (val < mn[k]) return 0;
  if (u <= l && r <= v) {
    if (val >= f[k]) {
      val -= (int)f[k];
      return (r - l + 1);
    }
  }
  if (l >= r) return 0;
  down(k, l, r);
  int m = (l + r) >> 1;
  int ans = get((k << 1), u, v, l, m, val);
  ans += get((k << 1) | 1, u, v, m + 1, r, val);
  pup(k);
  return ans;
}
void process() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  build(1, 1, n);
  while (m--) {
    int t, x, y;
    cin >> t >> x >> y;
    if (t == 1) {
      up(1, 1, x, 1, n, y);
    } else {
      cout << get(1, x, n, 1, n, y) << "\n";
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  process();
  return 0;
}
