#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
void debug_out() { clog << '\n'; }
template <typename H, typename... T>
void debug_out(H head, T... tail) {
  clog << " " << head;
  debug_out(tail...);
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (auto &i : vec) os << i << ' ';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<vector<T>> &vec) {
  if (!vec.empty()) os << vec[0];
  for (size_t i = 1; i < vec.size(); ++i) os << '\n' << vec[i];
  return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.first << ' ' << p.second;
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &s) {
  for (auto &i : s) os << i << ' ';
  return os;
}
struct SegmentTree {
  int n;
  vector<int> mi;
  vector<int64_t> sum;
  vector<int> push_value;
  SegmentTree(int _n) : n(_n) {
    mi.resize(4 * n);
    sum.resize(4 * n);
    push_value.resize(4 * n);
  }
  void push(int v, int tl, int tr) {
    if (push_value[v]) {
      push_value[v * 2] = push_value[v * 2 + 1] = push_value[v];
      int mid = tl + tr >> 1;
      mi[v * 2] = mi[v * 2 + 1] = push_value[v];
      sum[v * 2] = 1LL * (mid - tl + 1) * push_value[v];
      sum[v * 2 + 1] = 1LL * (tr - mid) * push_value[v];
      push_value[v] = 0;
    }
  }
  void update(int l, int r, int val) { update(1, 0, n - 1, l, r, val); }
  void update(int v, int tl, int tr, int l, int r, int val) {
    if (l > r) return;
    if (tl == l && tr == r) {
      push_value[v] = val;
      sum[v] = 1LL * (r - l + 1) * val;
      mi[v] = val;
    } else {
      push(v, tl, tr);
      int mid = tl + tr >> 1;
      update(v * 2, tl, mid, l, min(mid, r), val);
      update(v * 2 + 1, mid + 1, tr, max(mid + 1, l), r, val);
      mi[v] = min(mi[v * 2], mi[v * 2 + 1]);
      sum[v] = sum[v * 2] + sum[v * 2 + 1];
    }
  }
  int ask(int l, int r, int y) { return ask(1, 0, n - 1, l, r, y); }
  int ask(int v, int tl, int tr, int l, int r, int y) {
    if (mi[v] >= y || l > r) return -1;
    if (tl == tr) return tl;
    push(v, tl, tr);
    int mid = tl + tr >> 1;
    int ans = ask(v * 2, tl, mid, l, min(mid, r), y);
    if (ans == -1) ans = ask(v * 2 + 1, mid + 1, tr, max(mid + 1, l), r, y);
    return ans;
  }
  int query(int l, int r, int &y) { return query(1, 0, n - 1, l, r, y); }
  int query(int v, int tl, int tr, int l, int r, int &y) {
    if (mi[v] > y || l > r) return 0;
    if (tl == tr) return y -= sum[v], 1;
    if (tl == l && tr == r && y >= sum[v]) return y -= sum[v], (r - l + 1);
    push(v, tl, tr);
    int mid = tl + tr >> 1;
    int ans = query(v * 2, tl, mid, l, min(mid, r), y);
    ans += query(v * 2 + 1, mid + 1, tr, max(mid + 1, l), r, y);
    return ans;
  }
  int get_element(int pos) { return get_element(1, 0, n - 1, pos); }
  int get_element(int v, int tl, int tr, int pos) {
    if (tl == tr) return sum[v];
    push(v, tl, tr);
    int mid = tl + tr >> 1;
    if (pos <= mid) return get_element(v * 2, tl, mid, pos);
    return get_element(v * 2 + 1, mid + 1, tr, pos);
  }
  void print_tree() {
    cout << "{";
    if (n) cout << get_element(1, 0, n - 1, 0);
    for (int i = 1; i < n; ++i) cout << ", " << get_element(1, 0, n - 1, i);
    cout << "}\n";
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  SegmentTree st(n);
  for (int i = 0; i < n; ++i) {
    int val;
    cin >> val;
    st.update(i, i, val);
  }
  while (q--) {
    int type, x, y;
    cin >> type >> x >> y;
    --x;
    if (type == 1) {
      int pos = st.ask(0, x, y);
      if (pos != -1) st.update(pos, x, y);
    } else {
      int ans = st.query(x, n - 1, y);
      cout << ans << '\n';
    }
  }
  return 0;
}
