#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &n) {
  n = 0;
  T f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (isdigit(c)) n = n * 10 + c - '0', c = getchar();
  n *= f;
}
template <typename T>
void write(T n) {
  if (n < 0) putchar('-'), n = -n;
  if (n > 9) write(n / 10);
  putchar(n % 10 + '0');
}
int n, m;
long long a[800005], s[800005], tag[800005], mn[800005];
long long lim, res;
void push_up(int p) {
  s[p] = s[(p << 1)] + s[(p << 1 | 1)];
  mn[p] = min(mn[(p << 1)], mn[(p << 1 | 1)]);
}
void push_down(int p, int l, int r) {
  if (!tag[p]) return;
  tag[(p << 1)] = tag[(p << 1 | 1)] = tag[p];
  mn[(p << 1)] = mn[(p << 1 | 1)] = tag[p];
  s[(p << 1)] = tag[p] * (((l + r) >> 1) - l + 1);
  s[(p << 1 | 1)] = tag[p] * (r - ((l + r) >> 1));
  tag[p] = 0;
}
void build(int p, int l, int r) {
  tag[p] = 0;
  if (l == r) {
    s[p] = mn[p] = a[l];
    return;
  }
  build((p << 1), l, ((l + r) >> 1)),
      build((p << 1 | 1), ((l + r) >> 1) + 1, r);
  push_up(p);
}
void update(int p, int l, int r, int ul, int ur, long long k) {
  if (l >= ul && r <= ur) {
    s[p] = k * (r - l + 1);
    tag[p] = k, mn[p] = k;
    return;
  }
  push_down(p, l, r);
  if (((l + r) >> 1) >= ul) update((p << 1), l, ((l + r) >> 1), ul, ur, k);
  if (((l + r) >> 1) < ur)
    update((p << 1 | 1), ((l + r) >> 1) + 1, r, ul, ur, k);
  push_up(p);
}
long long query(int p, int l, int r, int ul, int ur) {
  if (l >= ul && r <= ur) return s[p];
  push_down(p, l, r);
  long long res = 0;
  if (((l + r) >> 1) >= ul) res += query((p << 1), l, ((l + r) >> 1), ul, ur);
  if (((l + r) >> 1) < ur)
    res += query((p << 1 | 1), ((l + r) >> 1) + 1, r, ul, ur);
  return res;
}
void solve(int p, int l, int r) {
  if (mn[p] > lim) return;
  if (lim >= s[p]) {
    lim -= s[p];
    res += (r - l + 1);
    return;
  }
  push_down(p, l, r);
  if (s[(p << 1)] > lim)
    solve((p << 1), l, ((l + r) >> 1));
  else
    lim -= s[(p << 1)], res += (((l + r) >> 1) - l + 1);
  solve((p << 1 | 1), ((l + r) >> 1) + 1, r);
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) read(a[i]);
  build(1, 1, n);
  int t, x, y;
  while (m--) {
    read(t), read(x), read(y);
    if (t == 1) {
      int l = 1, r = x, mid, ans = n + 1;
      while (l <= r) {
        mid = (l + r) >> 1;
        long long k = query(1, 1, n, mid, mid);
        if (k < y)
          ans = mid, r = mid - 1;
        else
          l = mid + 1;
      }
      if (ans <= x) update(1, 1, n, ans, x, y);
    } else {
      res = 0, lim = y;
      if (x > 1) lim += query(1, 1, n, 1, x - 1);
      solve(1, 1, n);
      write(res - (x - 1)), puts("");
    }
  }
  return 0;
}
