#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 200005;
ll st[4 * N];
int lz[4 * N];
int n, q, a[N];
void prop(int p, int L, int R) {
  if (lz[p]) {
    st[p] = 1LL * (R - L + 1) * lz[p];
    a[L] = a[R] = lz[p];
    if (L < R) {
      lz[2 * p] = lz[2 * p + 1] = lz[p];
    }
    lz[p] = 0;
  }
}
void upd(int p, int L, int R, int i, int y) {
  prop(p, L, R);
  if (L > i or a[R] >= y) return;
  if (a[L] <= y and R <= i) {
    lz[p] = y;
    prop(p, L, R);
    return;
  }
  int mid = (L + R) / 2;
  upd(2 * p, L, mid, i, y);
  upd(2 * p + 1, mid + 1, R, i, y);
  st[p] = st[2 * p] + st[2 * p + 1];
}
int query(int p, int L, int R, int i, int &y) {
  prop(p, L, R);
  if (R < i) return 0;
  if (L >= i and y >= st[p]) {
    y -= st[p];
    return R - L + 1;
  }
  if (L == R) return 0;
  if (a[R] > y) return 0;
  int mid = (L + R) / 2;
  int ans = query(2 * p, L, mid, i, y);
  ans += query(2 * p + 1, mid + 1, R, i, y);
  return ans;
}
void build(int p, int L, int R) {
  if (L == R) {
    st[p] = a[L];
    return;
  }
  int mid = (L + R) / 2;
  build(2 * p, L, mid);
  build(2 * p + 1, mid + 1, R);
  st[p] = st[2 * p] + st[2 * p + 1];
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  build(1, 1, n);
  while (q--) {
    int t, x, y;
    scanf("%d %d %d", &t, &x, &y);
    if (t == 1) {
      upd(1, 1, n, x, y);
    } else {
      printf("%d\n", query(1, 1, n, x, y));
    }
  }
}
