#include <bits/stdc++.h>
using namespace std;
struct mn_mx {
  long long mn, mx;
};
class seg_tree {
 public:
  seg_tree(long long n) {
    while (x < n) x *= 2;
    tree.resize(x * 2 - 1);
    segments.resize(x * 2 - 1);
    sum.resize(x * 2 - 1);
    for (long long i = x - 1; i < x - 1 + n; i++)
      cin >> tree[i].mn, tree[i].mx = tree[i].mn;
    for (long long i = x - 1 + n; i < tree.size(); i++)
      tree[i].mn = INT_MAX, tree[i].mx = tree[i].mn;
    make_tree(0);
  }
  void make_tree(long long i) {
    if (i >= x - 1) {
      segments[i].first = i - x + 2;
      segments[i].second = i - x + 2;
      sum[i] = tree[i].mn;
      return;
    }
    make_tree(i * 2 + 1);
    make_tree(i * 2 + 2);
    sum[i] = sum[i * 2 + 1] + sum[i * 2 + 2];
    tree[i].mn = min(tree[i * 2 + 1].mn, tree[i * 2 + 2].mn);
    tree[i].mx = max(tree[i * 2 + 1].mx, tree[i * 2 + 2].mx);
    segments[i].first = segments[i * 2 + 1].first;
    segments[i].second = segments[i * 2 + 2].second;
  }
  void update(long long i, long long id, long long y, long long mx = 0) {
    mx = max(mx, tree[i].mn);
    tree[i].mn = mx;
    tree[i].mx = max(mx, tree[i].mx);
    if (tree[i].mx == tree[i].mn) {
      sum[i] = mx * (segments[i].second - segments[i].first + 1);
    }
    if (segments[i].first > id) return;
    if (tree[i].mn > y) return;
    if (segments[i].second > id) {
      update(i * 2 + 1, id, y, mx);
      update(i * 2 + 2, id, y, mx);
      sum[i] = sum[i * 2 + 1] + sum[i * 2 + 2];
      tree[i].mn = min(tree[i * 2 + 1].mn, tree[i * 2 + 2].mn);
      tree[i].mx = max(tree[i * 2 + 1].mx, tree[i * 2 + 2].mx);
      return;
    }
    if (tree[i].mx <= y) {
      tree[i].mn = tree[i].mx = y;
      sum[i] = y * (segments[i].second - segments[i].first + 1);
      return;
    }
    if (i >= x - 1) return;
    update(i * 2 + 1, id, y, mx);
    update(i * 2 + 2, id, y, mx);
    tree[i].mn = min(tree[i * 2 + 1].mn, tree[i * 2 + 2].mn);
    tree[i].mx = max(tree[i * 2 + 1].mx, tree[i * 2 + 2].mx);
    sum[i] = sum[i * 2 + 1] + sum[i * 2 + 2];
  }
  void calc_ans(long long i = 0, long long mx = 0) {
    mx = max(tree[i].mn, mx);
    tree[i].mn = mx;
    tree[i].mx = max(tree[i].mx, mx);
    if (tree[i].mx == tree[i].mn) {
      sum[i] = mx * (segments[i].second - segments[i].first + 1);
    }
    if (left_segment > segments[i].second) return;
    if (money < tree[i].mn) {
      left_segment = segments[i].second + 1;
      return;
    }
    if (left_segment > segments[i].first) {
      if (i >= x - 1) return;
      calc_ans(i * 2 + 1, mx);
      calc_ans(i * 2 + 2, mx);
      tree[i].mn = min(tree[i * 2 + 1].mn, tree[i * 2 + 2].mn);
      tree[i].mx = max(tree[i * 2 + 1].mx, tree[i * 2 + 2].mx);
      sum[i] = sum[i * 2 + 1] + sum[i * 2 + 2];
      return;
    }
    if (money >= sum[i]) {
      ans += segments[i].second - segments[i].first + 1;
      money -= sum[i];
      left_segment = segments[i].second + 1;
      return;
    }
    if (i >= x - 1) return;
    calc_ans(i * 2 + 1, mx);
    calc_ans(i * 2 + 2, mx);
    tree[i].mn = min(tree[i * 2 + 1].mn, tree[i * 2 + 2].mn);
    tree[i].mx = max(tree[i * 2 + 1].mx, tree[i * 2 + 2].mx);
    sum[i] = sum[i * 2 + 1] + sum[i * 2 + 2];
  }
  void to_money(long long y) { money = y; }
  void to_left(long long id) { left_segment = id; }
  void show() const {
    long long a = 0;
    for (const mn_mx& i : tree)
      cout << i.mn << " " << i.mx << " " << sum[a++] << endl;
    cout << endl;
  }
  long long get_ans() {
    long long x = ans;
    ans = 0;
    return x;
  }

 private:
  long long x = 1;
  long long ans = 0, left_segment = 0, money;
  vector<mn_mx> tree;
  vector<long long> sum;
  vector<pair<long long, long long>> segments;
};
int main() {
  long long n, q;
  cin >> n >> q;
  seg_tree tree(n);
  while (q--) {
    long long t, id, y;
    cin >> t >> id >> y;
    if (t == 1)
      tree.update(0, id, y);
    else {
      tree.to_left(id);
      tree.to_money(y);
      tree.calc_ans();
      cout << tree.get_ans() << endl;
    }
  }
}
