#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
struct tree {
  int lt, rt;
  int mi, mx;
  long long sum;
  long long flag;
} a[N << 2];
void update(int step) {
  a[step].mx = max(a[step << 1].mx, a[step << 1 | 1].mx);
  a[step].mi = min(a[step << 1].mi, a[step << 1 | 1].mi);
  a[step].sum = a[step << 1].sum + a[step << 1 | 1].sum;
}
void init(int lt, int rt, int step) {
  a[step].lt = lt;
  a[step].rt = rt;
  a[step].flag = 0;
  if (lt == rt) {
    int x;
    scanf("%d", &x);
    a[step].mi = a[step].mx = a[step].sum = x;
    return;
  }
  int mid = (lt + rt) >> 1;
  init(lt, mid, step << 1);
  init(mid + 1, rt, step << 1 | 1);
  update(step);
}
void update(int step, int val) {
  a[step].flag = a[step].mi = a[step].mx = val;
  a[step].sum = 1LL * (a[step].rt - a[step].lt + 1) * val;
}
void down(int step) {
  if (!a[step].flag) return;
  update(step << 1, a[step].flag);
  update(step << 1 | 1, a[step].flag);
  a[step].flag = 0;
}
void update(int pos, int step, int val) {
  if (a[step].mi >= val) return;
  if (a[step].lt > pos) return;
  if (a[step].lt == a[step].rt) {
    a[step].mx = a[step].mi = a[step].sum = val;
    return;
  }
  if (a[step].rt <= pos && a[step].mx <= val) {
    update(step, val);
    return;
  }
  down(step);
  update(pos, step << 1, val);
  update(pos, step << 1 | 1, val);
  update(step);
}
int query(int lt, int rt, int step, int &val) {
  if (a[step].rt < lt) return 0;
  if (a[step].lt > rt) return 0;
  if (a[step].mi > val) return 0;
  if (a[step].lt == a[step].rt) {
    val -= a[step].mi;
    return 1;
  }
  if (lt <= a[step].lt && a[step].rt <= rt && a[step].sum <= val) {
    val -= a[step].sum;
    return a[step].rt - a[step].lt + 1;
  }
  down(step);
  if (lt > a[step << 1].rt) return query(lt, rt, step << 1 | 1, val);
  if (rt <= a[step << 1].rt) return query(lt, rt, step << 1, val);
  int lans = query(lt, a[step << 1].rt, step << 1, val);
  int rans = query(a[step << 1 | 1].lt, rt, step << 1 | 1, val);
  return lans + rans;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  init(1, n, 1);
  while (m--) {
    int t, x, y;
    scanf("%d%d%d", &t, &x, &y);
    if (t == 1)
      update(x, 1, y);
    else
      printf("%d\n", query(x, n, 1, y));
  }
  return 0;
}
