#include <bits/stdc++.h>
using namespace std;
int dx[] = {+1, -1, 0, 0};
int dy[] = {0, 0, +1, -1};
int n, q;
int a[200005];
long long sum[200005 * 4], small[200005 * 4], big[200005 * 4], lazy[200005 * 4];
long long hand;
void propagate(int node, long long st, long long en) {
  if (st != en) {
    lazy[node * 2] = lazy[node];
    lazy[node * 2 + 1] = lazy[node];
  }
  small[node] = lazy[node];
  big[node] = lazy[node];
  sum[node] = (en - st + 1) * lazy[node];
  lazy[node] = 0;
}
void determine(int node, int l, int mid, int r) {
  long long sum1 = sum[node * 2], small1 = small[node * 2],
            big1 = big[node * 2];
  long long sum2 = sum[node * 2 + 1], small2 = small[node * 2 + 1],
            big2 = big[node * 2 + 1];
  if (lazy[node * 2]) {
    sum1 = 1LL * lazy[node * 2] * (mid - l + 1);
    small1 = lazy[node * 2];
    big1 = lazy[node * 2];
  }
  if (lazy[node * 2 + 1]) {
    sum2 = 1LL * lazy[node * 2 + 1] * (r - mid);
    small2 = lazy[node * 2 + 1];
    big2 = lazy[node * 2 + 1];
  }
  sum[node] = sum1 + sum2;
  small[node] = min(small1, small2);
  big[node] = max(big1, big2);
}
void build(int node, int l, int r) {
  if (l == r) {
    sum[node] = a[l];
    small[node] = a[l];
    big[node] = a[l];
  } else {
    int mid = (l + r) / 2;
    build(node * 2, l, mid);
    build(node * 2 + 1, mid + 1, r);
    determine(node, l, mid, r);
  }
}
void update(int node, int l, int r, int i, int j, int val) {
  if (l > j || r < i)
    return;
  else if (l >= i && r <= j) {
    if (lazy[node]) propagate(node, l, r);
    if (big[node] < val && small[node] < val) {
      lazy[node] = val;
    } else if (small[node] < val) {
      int mid = (l + r) / 2;
      update(node * 2, l, mid, i, j, val);
      update(node * 2 + 1, mid + 1, r, i, j, val);
      determine(node, l, mid, r);
    }
  } else {
    if (lazy[node]) propagate(node, l, r);
    int mid = (l + r) / 2;
    update(node * 2, l, mid, i, j, val);
    update(node * 2 + 1, mid + 1, r, i, j, val);
    determine(node, l, mid, r);
  }
}
long long query(int node, int l, int r, int i, int j) {
  if (l > j || r < i)
    return 0;
  else if (l >= i && r <= j) {
    if (lazy[node]) propagate(node, l, r);
    if (sum[node] <= hand) {
      hand -= sum[node];
      return (r - l + 1);
    } else if (small[node] > hand)
      return 0;
    else {
      int mid = (l + r) / 2;
      long long res =
          query(node * 2, l, mid, i, j) + query(node * 2 + 1, mid + 1, r, i, j);
      determine(node, l, mid, r);
      return res;
    }
  } else {
    if (lazy[node]) propagate(node, l, r);
    int mid = (l + r) / 2;
    long long res =
        query(node * 2, l, mid, i, j) + query(node * 2 + 1, mid + 1, r, i, j);
    determine(node, l, mid, r);
    return res;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) cin >> a[i];
  build(1, 1, n);
  for (int i = 1; i <= q; i++) {
    int t, x, y;
    cin >> t >> x >> y;
    if (t == 1) {
      update(1, 1, n, 1, x, y);
    } else {
      hand = y;
      long long ans = query(1, 1, n, x, n);
      cout << ans << endl;
    }
  }
  return 0;
}
