#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
ostream &operator<<(ostream &os, pair<T1, T2> &p);
template <class T>
ostream &operator<<(ostream &os, vector<T> &v);
template <class T>
ostream &operator<<(ostream &os, set<T> &v);
inline void optimizeIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
const int nmax = 2e5 + 7;
struct Node {
  long long mn, mx, sum;
  long long lazy;
  Node() { mn = INT_MAX, mx = sum = 0, lazy = 0; }
  void create_leaf(long long val) { mn = mx = sum = val, lazy = 0; }
};
Node merge_nodes(Node &a, Node &b) {
  Node temp;
  temp.mn = min(a.mn, b.mn);
  temp.mx = max(a.mx, b.mx);
  temp.sum = a.sum + b.sum;
  return temp;
}
struct LazySegTree {
  long long n;
  vector<long long> data;
  vector<Node> Tree;
  LazySegTree(long long n) {
    this->n = n;
    long long len = n + 1;
    data = vector<long long>(len);
    Tree = vector<Node>(len << 2);
  }
  void build() {
    build(1, 1, n);
    return;
  }
  void build(long long cur, long long start, long long end) {
    if (start == end) {
      Tree[cur].create_leaf(data[start]);
      return;
    }
    long long mid = (start + end) >> 1;
    long long lc = cur << 1, rc = lc | 1;
    build(lc, start, mid);
    build(rc, mid + 1, end);
    Tree[cur] = merge_nodes(Tree[lc], Tree[rc]);
  }
  void node_update(long long v, long long st, long long en, long long val) {
    Tree[v].mn = val;
    Tree[v].mx = val;
    Tree[v].sum = (en - st + 1) * val;
    Tree[v].lazy = val;
  }
  void push(long long v, long long st, long long en) {
    long long mid = (st + en) >> 1;
    long long lc = v << 1, rc = lc | 1;
    if (Tree[v].lazy && st != en) {
      node_update(lc, st, mid, Tree[v].lazy);
      node_update(rc, mid + 1, en, Tree[v].lazy);
      Tree[v].lazy = 0;
    }
  }
  void update(long long ql, long long qr, long long upd_with_mx) {
    update(1, 1, n, ql, qr, upd_with_mx);
  }
  void update(long long cur, long long start, long long end, long long ql,
              long long qr, long long upd_with_mx) {
    push(cur, start, end);
    if (end < ql || start > qr) return;
    if (Tree[cur].mn >= upd_with_mx) return;
    if (start >= ql && end <= qr && Tree[cur].mx < upd_with_mx) {
      node_update(cur, start, end, upd_with_mx);
      return;
    }
    long long mid = (start + end) >> 1;
    long long lc = cur << 1, rc = lc | 1;
    update(lc, start, mid, ql, qr, upd_with_mx);
    update(rc, mid + 1, end, ql, qr, upd_with_mx);
    Tree[cur] = merge_nodes(Tree[lc], Tree[rc]);
  }
  long long query(long long ql, long long qr, long long &rem) {
    return query(1, 1, n, ql, qr, rem);
  }
  long long query(long long cur, long long start, long long end, long long ql,
                  long long qr, long long &rem) {
    push(cur, start, end);
    if (end < ql || start > qr) return 0;
    if (start >= ql && end <= qr) {
      if (rem >= Tree[cur].sum) {
        rem -= Tree[cur].sum;
        return (end - start + 1);
      }
      if (rem < Tree[cur].mn) return 0;
    }
    long long mid = (start + end) >> 1;
    long long lc = cur << 1, rc = lc | 1;
    long long ansL = query(lc, start, mid, ql, qr, rem);
    long long ansR = query(rc, mid + 1, end, ql, qr, rem);
    return ansL + ansR;
  }
};
void solveTC() {
  long long n, q;
  cin >> n >> q;
  LazySegTree s(n);
  for (long long i = 1; i <= n; i++) cin >> s.data[i];
  s.build();
  while (q--) {
    long long type;
    cin >> type;
    if (type == 1) {
      long long l = 1, r, upd_val;
      cin >> r >> upd_val;
      s.update(l, r, upd_val);
    } else {
      long long l, r = n, rem;
      cin >> l >> rem;
      long long ans = s.query(l, r, rem);
      cout << ans << "\n";
      ;
    }
  }
}
int32_t main() {
  optimizeIO();
  long long tc = 1;
  while (tc--) {
    solveTC();
  }
  return 0;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, pair<T1, T2> &p) {
  os << "{" << p.first << ", " << p.second << "} ";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "[ ";
  for (T i : v) {
    os << i << " ";
  }
  os << " ]";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, set<T> &v) {
  os << "[ ";
  for (T i : v) {
    os << i << " ";
  }
  os << " ]";
  return os;
}
