#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
template <class T>
T sqr(T x) {
  return x * x;
}
const double eps = 1e-8;
const double pi = acos(-1.);
const int inf = 1e9 + 7;
const int N = 2e5 + 20;
int n, m;
int a[N], mi[4 * N];
long long t[4 * N], how[4 * N];
inline void push(int v, int tl, int tr) {
  if (!how[v]) return;
  how[2 * v + 1] = how[v];
  how[2 * v + 2] = how[v];
  int c = (tl + tr) >> 1;
  t[2 * v + 1] = how[v] * (c - tl + 1);
  t[2 * v + 2] = how[v] * (tr - c);
  mi[2 * v + 1] = mi[2 * v + 2] = how[v];
  how[v] = 0;
}
void modify(int v, int tl, int tr, int l, int r, int h) {
  if (tl > r || l > tr) return;
  if (l <= tl && tr <= r) {
    how[v] = h;
    mi[v] = h;
    t[v] = how[v] * (tr - tl + 1);
    return;
  }
  push(v, tl, tr);
  int c = (tl + tr) >> 1;
  modify(2 * v + 1, tl, c, l, r, h);
  modify(2 * v + 2, c + 1, tr, l, r, h);
  t[v] = t[2 * v + 1] + t[2 * v + 2];
  mi[v] = min(mi[2 * v + 1], mi[2 * v + 2]);
}
inline long long get(int v, int tl, int tr, int l, int r) {
  if (tl > r || l > tr) return 0;
  if (l <= tl && tr <= r) return t[v];
  push(v, tl, tr);
  int c = (tl + tr) >> 1;
  return get(2 * v + 1, tl, c, l, r) + get(2 * v + 2, c + 1, tr, l, r);
}
int getPos(int L, int R, int y) {
  auto f = get(0, 0, n - 1, L, L);
  if (f <= y) return L;
  f = get(0, 0, n - 1, R, R);
  if (f > y) return R + 1;
  int v = 0, tl = 0, tr = n - 1;
  while (tl != tr) {
    push(v, tl, tr);
    int c = (tl + tr) >> 1;
    if (mi[2 * v + 1] <= y) {
      v = 2 * v + 1;
      tr = c;
    } else {
      v = 2 * v + 2;
      tl = c + 1;
    }
  }
  return min(R + 1, tl);
  int l = L;
  int r = R;
  while (l <= r) {
    int c = (l + r) >> 1;
    auto cur = get(0, 0, n - 1, c, c);
    if (cur > y)
      l = c + 1;
    else
      r = c - 1;
  }
  return l;
}
int go(int v, int tl, int tr, long long h) {
  if (tl == tr) return tl;
  push(v, tl, tr);
  int c = (tl + tr) >> 1;
  if (h >= t[2 * v + 1])
    return go(2 * v + 2, c + 1, tr, h - t[2 * v + 1]);
  else
    return go(2 * v + 1, tl, c, h);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    modify(0, 0, n - 1, i, i, x);
  }
  while (m--) {
    int type, x, y;
    cin >> type >> x >> y;
    x--;
    if (type == 1) {
      int l = getPos(0, x, y);
      if (l <= x) modify(0, 0, n - 1, l, x, y);
    } else {
      int pos = getPos(x, n - 1, y);
      int ans = 0;
      int cnt = 0;
      while (pos < n) {
        cnt++;
        if (get(0, 0, n - 1, pos, n - 1) <= y) {
          ans += n - pos;
          break;
        }
        long long sum = pos ? get(0, 0, n - 1, 0, pos - 1) : 0;
        int l = 0;
        int v = 0, tl = 0, tr = n - 1;
        sum += y;
        while (1) {
          if (tl == tr) {
            l = tl;
            break;
          }
          push(v, tl, tr);
          int c = (tl + tr) >> 1;
          if (sum >= t[2 * v + 1]) {
            v = 2 * v + 2;
            tl = c + 1;
            sum -= t[v - 1];
          } else {
            v = 2 * v + 1;
            tr = c;
          }
        }
        y -= get(0, 0, n - 1, pos, l - 1);
        ans += l - pos;
        pos = getPos(l, n - 1, y);
      }
      assert(cnt < 40);
      cout << ans << '\n';
    }
  }
}
