#include <bits/stdc++.h>
using namespace std;
const long long BIG_INF = 4e18;
const long long INF = 1e9;
const long long mod = 1e9 + 7;
long long fast_exp(long long a, long long b) {
  if (b <= 0)
    return 1;
  else {
    long long res = 1;
    res = fast_exp(a, b / 2);
    res = res % mod;
    res = (res * res) % mod;
    if (b % 2 == 1) res = (res * a) % mod;
    return res;
  }
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long true_rand(long long n) {
  uniform_int_distribution<long long> uid(0, n - 1);
  return uid(rng);
}
const long long N = 1e5 + 1000;
const long double pi = acos(-1.0);
using cd = complex<double>;
const double PI = acos(-1);
double eps = 1e-12;
struct seg_tree_max {
  vector<int> bit;
  vector<int> a;
  vector<int> lazy;
  int n;
  seg_tree_max(int n) {
    this->n = n;
    bit.assign(4 * n + 5, 0);
    lazy.assign(4 * n + 5, 0);
  }
  seg_tree_max(vector<int> a) : seg_tree_max(a.size()) {
    this->a = a;
    build(0, 0, (int)a.size() - 1);
  }
  int merge(int x, int y) { return max(x, y); }
  void build(int node, int start, int end) {
    if (start == end) {
      bit[node] = a[start];
      return;
    }
    int lch = 2 * node + 1;
    int rch = 2 * node + 2;
    int mid = (start + end) / 2;
    build(lch, start, mid);
    build(rch, mid + 1, end);
    bit[node] = merge(bit[lch], bit[rch]);
    return;
  }
  void push(int v, int tl, int tr) {
    if (tl == tr) return;
    if (lazy[v] != 0) {
      bit[v * 2 + 1] = max(lazy[v], bit[2 * v + 1]);
      lazy[v * 2 + 1] = max(lazy[v], lazy[2 * v + 1]);
      bit[v * 2 + 2] = max(lazy[v], bit[2 * v + 2]);
      lazy[v * 2 + 2] = max(lazy[v], lazy[2 * v + 2]);
    }
    lazy[v] = 0;
  }
  void update(int v, int tl, int tr, int l, int r, int max_cand) {
    if (l > r) return;
    if (l == tl && tr == r) {
      bit[v] = max(bit[v], max_cand);
      lazy[v] = max(lazy[v], max_cand);
    } else {
      push(v, tl, tr);
      int tm = (tl + tr) / 2;
      update(v * 2 + 1, tl, tm, l, min(r, tm), max_cand);
      update(v * 2 + 2, tm + 1, tr, max(l, tm + 1), r, max_cand);
      bit[v] = merge(bit[v * 2 + 1], bit[v * 2 + 2]);
    }
  }
  int query(int v, int tl, int tr, int l, int r) {
    if (l > r) return 0;
    if (l <= tl && tr <= r) return bit[v];
    push(v, tl, tr);
    int tm = (tl + tr) / 2;
    return merge(query(v * 2 + 1, tl, tm, l, min(r, tm)),
                 query(v * 2 + 2, tm + 1, tr, max(l, tm + 1), r));
  }
  int binary_search(int v, int tl, int tr, int cost) {
    if (tl != tr)
      ;
    push(v, tl, tr);
    if (tl == tr && bit[v] > cost)
      return 1000000000LL;
    else if (bit[v] <= cost)
      return tl;
    else {
      int mid = (tl + tr) / 2;
      if (bit[2 * v + 1] <= cost)
        return binary_search(2 * v + 1, tl, mid, cost);
      else if (bit[2 * v + 1] > cost && bit[2 * v + 2] <= cost)
        return min(binary_search(2 * v + 1, tl, mid, cost), mid + 1);
      else
        return binary_search(2 * v + 2, mid + 1, tr, cost);
    }
  }
};
struct seg_tree {
  vector<long long> bit;
  vector<int> a;
  vector<int> lazy;
  int n;
  seg_tree(int n) {
    this->n = n;
    bit.assign(4 * n + 5, 0);
    lazy.assign(4 * n + 5, 0);
  }
  seg_tree(vector<int> a) : seg_tree(a.size()) {
    this->a = a;
    build(0, 0, (int)a.size() - 1);
  }
  long long merge(long long x, long long y) { return x + y; }
  void build(int node, int start, int end) {
    if (start == end) {
      bit[node] = a[start];
      return;
    }
    int lch = 2 * node + 1;
    int rch = 2 * node + 2;
    int mid = (start + end) / 2;
    build(lch, start, mid);
    build(rch, mid + 1, end);
    bit[node] = merge(bit[lch], bit[rch]);
    return;
  }
  void push(int v, int tl, int tr) {
    if (tl == tr) {
      return;
    }
    if (lazy[v] != 0) {
      int mid = (tr + tl) / 2;
      bit[v * 2 + 1] = (long long)(mid - tl + 1) * lazy[v];
      lazy[v * 2 + 1] = lazy[v];
      bit[v * 2 + 2] = (long long)(tr - mid) * lazy[v];
      lazy[v * 2 + 2] = lazy[v];
    }
    lazy[v] = 0;
  }
  void update(int v, int tl, int tr, int l, int r, long long addend) {
    if (l > r) return;
    if (l == tl && tr == r) {
      bit[v] = (tr - tl + 1) * addend;
      lazy[v] = addend;
    } else {
      push(v, tl, tr);
      int tm = (tl + tr) / 2;
      update(v * 2 + 1, tl, tm, l, min(r, tm), addend);
      update(v * 2 + 2, tm + 1, tr, max(l, tm + 1), r, addend);
      bit[v] = merge(bit[v * 2 + 1], bit[v * 2 + 2]);
    }
  }
  int query(int v, int tl, int tr, int l, int r) {
    if (l > r) return 0;
    if (l <= tl && tr <= r) return bit[v];
    push(v, tl, tr);
    int tm = (tl + tr) / 2;
    return merge(query(v * 2 + 1, tl, tm, l, min(r, tm)),
                 query(v * 2 + 2, tm + 1, tr, max(l, tm + 1), r));
  }
  pair<int, int> get_number_of_shops(int v, int tl, int tr, int start,
                                     int money) {
    if (tl != tr)
      ;
    push(v, tl, tr);
    if (tl == tr) {
      if (start <= tl && bit[v] <= money)
        return {1, bit[v]};
      else
        return {0, 0};
    } else if (start <= tl && bit[v] <= money)
      return {tr - tl + 1, bit[v]};
    else {
      int mid = (tl + tr) / 2;
      if (start > mid) {
        return get_number_of_shops(2 * v + 2, mid + 1, tr, max(start, mid + 1),
                                   money);
      } else {
        pair<int, int> pl =
            get_number_of_shops(2 * v + 1, tl, mid, start, money);
        pair<int, int> pr = {0, 0};
        if (pl.first == mid - start + 1)
          pr = get_number_of_shops(2 * v + 2, mid + 1, tr, start,
                                   money - pl.second);
        pl.first += pr.first;
        pl.second += pr.second;
        return pl;
      }
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, q;
  cin >> n >> q;
  vector<int> a;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  seg_tree_max sgmax(a);
  seg_tree sgsum(a);
  int t, y;
  while (q--) {
    cin >> t >> x >> y;
    if (t == 1) {
      x--;
      int spos = sgmax.binary_search(0, 0, n - 1, y);
      if (spos <= x) {
        sgsum.update(0, 0, n - 1, spos, x, y);
        sgmax.update(0, 0, n - 1, spos, x, y);
      }
    } else {
      int num_shops = 0;
      x--;
      while (y > 0) {
        int br = sgmax.binary_search(0, 0, n - 1, y);
        int start = max(br, x);
        if (start < n) {
          pair<int, int> p = sgsum.get_number_of_shops(0, 0, n - 1, start, y);
          y -= p.second;
          num_shops += p.first;
          x = start + p.first;
        } else
          break;
      }
      cout << num_shops << '\n';
    }
  }
  return 0;
}
