#include <bits/stdc++.h>
using namespace std;
struct Node {
  long long left, right, max, min, sum, tag;
};
Node tree[1000000];
int a[200010];
void treeInit(int i, int left, int right) {
  if (right - left <= 1) {
    tree[i].left = left;
    tree[i].right = right;
    tree[i].max = tree[i].min = tree[i].sum = a[left - 1];
    tree[i].tag = 0;
    return;
  }
  int middle = (left + right) / 2;
  int ls = (i) << 1, rs = (i) << 1 | 1;
  treeInit(ls, left, middle);
  treeInit(rs, middle, right);
  tree[i].left = left;
  tree[i].right = right;
  tree[i].max = max(tree[ls].max, tree[rs].max);
  tree[i].min = min(tree[ls].min, tree[rs].min);
  tree[i].sum = tree[ls].sum + tree[rs].sum;
  tree[i].tag = 0;
}
void pushDown(int i) {
  if (tree[i].tag) {
    int ls = (i) << 1, rs = (i) << 1 | 1;
    tree[ls].max = tree[ls].min = tree[ls].tag = tree[i].tag;
    tree[ls].sum = (tree[ls].right - tree[ls].left) * tree[i].tag;
    tree[rs].max = tree[rs].min = tree[rs].tag = tree[i].tag;
    tree[rs].sum = (tree[rs].right - tree[rs].left) * tree[i].tag;
    tree[i].tag = 0;
  }
}
void op1(long long int x, long long int y, int i) {
  if (tree[i].left > x || tree[i].min >= y) {
    return;
  }
  if (tree[i].right <= x + 1 && tree[i].max < y) {
    tree[i].min = tree[i].max = y;
    tree[i].tag = y;
    tree[i].sum = (tree[i].right - tree[i].left) * y;
    return;
  }
  pushDown(i);
  int ls = (i) << 1, rs = (i) << 1 | 1;
  op1(x, y, ls);
  op1(x, y, rs);
  if (tree[i].right - tree[i].left > 1) {
    tree[i].max = max(tree[ls].max, tree[rs].max);
    tree[i].min = min(tree[ls].min, tree[rs].min);
    tree[i].sum = tree[ls].sum + tree[rs].sum;
  } else {
    tree[i].max = tree[i].min = tree[i].sum;
  }
}
long long int op2(long long int x, long long int &y, int i) {
  if (tree[i].right <= x || tree[i].min > y) {
    return 0;
  }
  if (tree[i].left >= x && tree[i].sum <= y) {
    y -= tree[i].sum;
    return tree[i].right - tree[i].left;
  }
  pushDown(i);
  int ls = (i) << 1, rs = (i) << 1 | 1;
  long long res = 0;
  res += op2(x, y, ls);
  res += op2(x, y, rs);
  return res;
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  treeInit(1, 1, n + 1);
  while (q--) {
    int cmd;
    long long x, y;
    scanf("%d%I64d%I64d", &cmd, &x, &y);
    if (cmd == 1) {
      op1(x, y, 1);
    } else {
      printf("%I64d\n", op2(x, y, 1));
    }
  }
  return 0;
}
