#include <bits/stdc++.h>
using namespace std;
const int N = 800010;
int a[N], tag[N], val[N];
long long sum[N];
int read() {
  int x = 0;
  char c = getchar(), flag = '+';
  while (!isdigit(c)) flag = c, c = getchar();
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return flag == '-' ? -x : x;
}
void up(int root) {
  sum[root] = sum[root << 1] + sum[root << 1 | 1];
  val[root] = val[root << 1 | 1];
}
void down(int root, int nl, int nr) {
  if (tag[root] != -1) {
    tag[root << 1] = tag[root << 1 | 1] = tag[root];
    sum[root << 1] = 1ll * tag[root] * nl;
    sum[root << 1 | 1] = 1ll * tag[root] * nr;
    val[root << 1] = val[root << 1 | 1] = tag[root];
    tag[root] = -1;
  }
}
void modify(int root, int l, int r, int x, int y, int k) {
  if (x <= l && y >= r) {
    sum[root] = 1ll * k * (r - l + 1);
    tag[root] = k, val[root] = k;
    return;
  }
  int mid = l + r >> 1;
  down(root, mid - l + 1, r - mid);
  if (x <= mid) modify(root << 1, l, mid, x, y, k);
  if (y > mid) modify(root << 1 | 1, mid + 1, r, x, y, k);
  up(root);
}
int query1(int root, int l, int r, int k) {
  if (l == r) {
    if (val[root] <= k)
      return l;
    else
      return 1e9;
  }
  int mid = l + r >> 1, ans = 0;
  down(root, mid - l + 1, r - mid);
  if (val[root << 1] > k) {
    ans = query1(root << 1 | 1, mid + 1, r, k);
  } else
    ans = query1(root << 1, l, mid, k);
  up(root);
  return ans;
}
long long query2(int root, int l, int r, int x, int y) {
  if (x > y) return 0;
  if (x <= l && y >= r) return sum[root];
  int mid = l + r >> 1;
  down(root, mid - l + 1, r - mid);
  long long ans = 0;
  if (x <= mid) ans += query2(root << 1, l, mid, x, y);
  if (y > mid) ans += query2(root << 1 | 1, mid + 1, r, x, y);
  up(root);
  return ans;
}
int query3(int root, int l, int r, long long k) {
  if (l == r) {
    if (sum[root] <= k)
      return l;
    else
      return l - 1;
  }
  int mid = l + r >> 1, ans = 0;
  down(root, mid - l + 1, r - mid);
  if (sum[root << 1] >= k)
    ans = query3(root << 1, l, mid, k);
  else
    ans = query3(root << 1 | 1, mid + 1, r, k - sum[root << 1]);
  up(root);
  return ans;
}
int main() {
  int n = read(), q = read();
  memset(tag, -1, sizeof(tag));
  for (int i = 1; i <= n; i++) a[i] = read(), modify(1, 1, n, i, i, a[i]);
  while (q--) {
    int t = read(), x = read(), y = read();
    if (t == 1) {
      int l = query1(1, 1, n, y);
      if (l <= x) modify(1, 1, n, l, x, y);
    } else {
      int zzz = 0;
      int pre = 0;
      int l = max(query1(1, 1, n, y), x), r = n, ans = l - 1;
      long long tmp = 0, lst = 0;
      pre = l;
      while (l <= r) {
        int mid = l + r >> 1;
        if ((tmp = query2(1, 1, n, pre, mid)) <= y)
          lst = tmp, ans = mid, l = mid + 1;
        else
          r = mid - 1;
      }
      zzz += ans - pre + 1, y -= lst, l = max(ans + 1, query1(1, 1, n, y));
      while (lst && l <= n) {
        r = n, ans = l - 1, tmp = lst = 0;
        pre = l;
        long long tmpsum = query2(1, 1, n, 1, l - 1);
        ans = max(l - 1, query3(1, 1, n, tmpsum + y));
        lst = query2(1, 1, n, pre, ans);
        zzz += ans - pre + 1, y -= lst, l = max(ans + 1, query1(1, 1, n, y));
      }
      cout << zzz << '\n';
    }
  }
  return 0;
}
