#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read() {
  T s = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = (s << 3) + (s << 1) + ch - 48;
    ch = getchar();
  }
  return s * f;
}
constexpr int N = 2e5 + 100;
int a[N];
struct SegmentTree {
  static const int M = 2e5 + 100;
  long long sum[M << 2], maxn[M << 2], minx[M << 2];
  void pushup(int node, int l, int r) {
    maxn[node] = max(maxn[node << 1], maxn[node << 1 | 1]);
    minx[node] = min(minx[node << 1], minx[node << 1 | 1]);
    sum[node] = sum[node << 1] + sum[node << 1 | 1];
  }
  void spread(int node, int l, int r) {
    if (maxn[node] == minx[node]) {
      maxn[node << 1] = maxn[node << 1 | 1] = maxn[node];
      minx[node << 1] = minx[node << 1 | 1] = minx[node];
      int mid = l + r >> 1;
      sum[node << 1] = (mid + 1 - l) * maxn[node << 1];
      sum[node << 1 | 1] = (r - mid) * maxn[node << 1 | 1];
    }
  }
  void build(int node, int l, int r) {
    if (l == r) {
      sum[node] = maxn[node] = minx[node] = a[l];
      return;
    }
    int mid = l + r >> 1;
    build(node << 1, l, mid);
    build(node << 1 | 1, mid + 1, r);
    pushup(node, l, r);
  }
  void change(int node, int l, int r, int L, int R, int val) {
    if (L == l && R == r) {
      if (minx[node] > val) return;
      if (l == r) {
        if (maxn[node] <= val) {
          maxn[node] = minx[node] = sum[node] = val;
        }
        return;
      }
      spread(node, l, r);
      if (maxn[node] <= val) {
        maxn[node] = minx[node] = val;
        sum[node] = val * (r - l + 1);
        return;
      }
      int mid = l + r >> 1;
      if (maxn[node] <= val) change(node << 1, l, mid, L, mid, val);
      if (maxn[node] <= val) change(node << 1 | 1, mid + 1, r, mid + 1, R, val);
      pushup(node, l, r);
    }
    spread(node, l, r);
    int mid = l + r >> 1;
    if (R <= mid)
      change(node << 1, l, mid, L, R, val);
    else if (L > mid)
      change(node << 1 | 1, mid + 1, r, L, R, val);
    else {
      change(node << 1, l, mid, L, mid, val);
      change(node << 1 | 1, mid + 1, r, mid + 1, R, val);
    }
    pushup(node, l, r);
  }
  pair<int, int> query(int node, int l, int r, int L, int R, int val) {
    if (L == l && R == r) {
      if (minx[node] > val) return {0, val};
      if (l == r) {
        if (minx[node] <= val) {
          val -= minx[node];
          return {1, val};
        } else
          return {0, val};
      }
      spread(node, l, r);
      if (maxn[node] == minx[node]) {
        if (maxn[node] <= val) {
          int num = min(val / maxn[node], 1LL * (r - l + 1));
          val -= num * maxn[node];
          return {num, val};
        } else
          return {0, val};
      }
      pair<int, int> lc{0, val}, rc{0, val};
      int mid = l + r >> 1;
      if (minx[node << 1] <= val) lc = query(node << 1, l, mid, L, mid, val);
      val = lc.second;
      rc = {0, val};
      if (minx[node << 1 | 1] <= val)
        rc = query(node << 1 | 1, mid + 1, r, mid + 1, R, val);
      val = rc.second;
      pushup(node, l, r);
      return {lc.first + rc.first, val};
    }
    spread(node, l, r);
    int mid = l + r >> 1;
    if (R <= mid)
      return query(node << 1, l, mid, L, R, val);
    else if (L > mid)
      return query(node << 1 | 1, mid + 1, r, L, R, val);
    else {
      pair<int, int> lc{0, val}, rc{0, val};
      if (minx[node << 1] <= val) lc = query(node << 1, l, mid, L, mid, val);
      val = lc.second;
      rc = {0, val};
      if (minx[node << 1 | 1] <= val)
        rc = query(node << 1 | 1, mid + 1, r, mid + 1, R, val);
      val = rc.second;
      return {lc.first + rc.first, val};
    }
  }
} tree;
int main() {
  int n = read<int>(), q = read<int>();
  for (int i = 1; i <= n; ++i) {
    a[i] = read<int>();
  }
  tree.build(1, 1, n);
  for (int i = 1; i <= q; ++i) {
    int type = read<int>(), x = read<int>(), y = read<int>();
    if (type == 1) {
      tree.change(1, 1, n, 1, x, y);
    } else {
      printf("%d\n", tree.query(1, 1, n, x, n, y).first);
    }
  }
}
