#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
struct node {
  int l, r;
  int max_num;
  int min_num;
  long long sum;
  int lazy;
} tree[4 * maxn];
long long a[maxn];
void push_up(int i) {
  tree[i].sum = tree[i << 1].sum + tree[(i << 1) + 1].sum;
  tree[i].max_num = max(tree[i << 1].max_num, tree[(i << 1) + 1].max_num);
  tree[i].min_num = min(tree[i << 1].min_num, tree[(i << 1) + 1].min_num);
}
void push_down(int i) {
  if (tree[i].lazy != -1) {
    tree[i << 1].lazy = tree[(i << 1) + 1].lazy = tree[i].lazy;
    tree[i << 1].min_num = tree[i].max_num = tree[i].lazy;
    tree[(i << 1) + 1].min_num = tree[(i << 1) + 1].max_num = tree[i].lazy;
    tree[i << 1].sum =
        1LL * (tree[i << 1].r - tree[i << 1].l + 1) * tree[i].lazy;
    tree[(i << 1) + 1].sum =
        1LL * (tree[(i << 1) + 1].r - tree[(i << 1) + 1].l + 1) * tree[i].lazy;
    tree[i].lazy = -1;
  }
}
void buildtree(int i, int l, int r) {
  tree[i].l = l;
  tree[i].r = r;
  tree[i].lazy = -1;
  tree[i].sum = 0;
  tree[i].max_num = 0;
  tree[i].min_num = 0;
  if (l == r) {
    tree[i].min_num = tree[i].max_num = tree[i].sum = a[l];
    return;
  }
  buildtree(i << 1, l, (l + r) / 2);
  buildtree((i << 1) + 1, (l + r) / 2 + 1, r);
  push_up(i);
}
void update(int i, int l, int r, int y) {
  if (tree[i].l == l && tree[i].r == r) {
    if (tree[i].min_num >= y) {
      return;
    }
    if (tree[i].max_num < y) {
      tree[i].min_num = tree[i].max_num = y;
      tree[i].sum = 1LL * (tree[i].r - tree[i].l + 1) * y;
      tree[i].lazy = y;
      return;
    }
  }
  push_down(i);
  int mid = (tree[i].l + tree[i].r) / 2;
  if (r <= mid) {
    update(i << 1, l, r, y);
  } else if (l > mid) {
    update((i << 1) + 1, l, r, y);
  } else {
    update(i << 1, l, mid, y);
    update((i << 1) + 1, mid + 1, r, y);
  }
  push_up(i);
}
int query(int i, int l, int r, int &m) {
  int ans = 0;
  if (tree[i].l == l && tree[i].r == r) {
    if (m >= tree[i].sum) {
      m -= tree[i].sum;
      return tree[i].r - tree[i].l + 1;
    }
    if (m < tree[i].min_num) return 0;
  }
  push_down(i);
  int mid = (tree[i].l + tree[i].r) / 2;
  if (l > mid) {
    return query((i << 1) + 1, l, r, m);
  } else if (r <= mid) {
    return query(i << 1, l, r, m);
  } else {
    ans += query(i << 1, l, mid, m);
    ans += query((i << 1) + 1, mid + 1, r, m);
    return ans;
  }
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  buildtree(1, 1, n);
  for (int i = 1; i <= q; i++) {
    int tp, x, y;
    scanf("%d%d%d", &tp, &x, &y);
    if (tp == 1) {
      update(1, 1, x, y);
    } else if (tp == 2) {
      int ans = query(1, x, n, y);
      printf("%d\n", ans);
    }
  }
}
