#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
clock_t START;
inline long double TIME() {
  return (long double)(clock() - START) / CLOCKS_PER_SEC;
}
void SHOW() {
  cout << fixed << setprecision(10);
  cout << TIME() << " SECONDS FROM START\n";
}
long double TL = 2.0;
long long calls = 0;
inline bool IS() {
  if (TL - TIME() < 0.1) return true;
  return false;
}
template <typename T1, typename T2>
inline bool amin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T1, typename T2>
inline bool amax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> &p) {
  os << p.first << ' ' << p.second;
  return os;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &u : v) is >> u;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto &u : v) os << u << ' ';
  return os;
}
long long hash_mod[4] = {1000000007, 998244353, 1000000009, 999999937},
          mod = hash_mod[rnd() % 4];
long long hash_pows[4] = {179, 239, 1007, 2003}, P = hash_pows[rnd() % 4];
long long binpow(long long first, long long p) {
  long long res = 1;
  while (p) {
    if (p % 2) res = (res * first) % mod;
    first = (first * first) % mod;
    p /= 2;
  }
  return res;
}
const long long N = 1e6 + 7, NS = 2e3 + 7, lg = 20, sq = 550, inf = 2e9 + 7;
const long double eps = 1e-9, pi = 3.14159265359;
long long mn[4 * N], sum[4 * N], add[4 * N], a[N], n, q;
void build(long long v, long long l, long long r) {
  if (l == r - 1) {
    sum[v] = mn[v] = a[l];
    add[v] = -1;
    return;
  }
  long long m = (l + r) / 2;
  build(2 * v, l, m);
  build(2 * v + 1, m, r);
  sum[v] = sum[2 * v] + sum[2 * v + 1];
  add[v] = -1;
  mn[v] = min(mn[2 * v], mn[2 * v + 1]);
}
void push(long long v, long long l, long long r) {
  if (add[v] == -1) return;
  sum[v] = (r - l) * add[v];
  mn[v] = add[v];
  if (r != l - 1) {
    add[2 * v] = add[2 * v + 1] = add[v];
  }
  add[v] = -1;
}
void update(long long v, long long l, long long r, long long vl, long long vr,
            long long val) {
  push(v, l, r);
  if (l >= vr || vl >= r) return;
  if (l >= vl && r <= vr) {
    add[v] = val;
    push(v, l, r);
    return;
  }
  long long m = (l + r) / 2;
  update(2 * v, l, m, vl, vr, val);
  update(2 * v + 1, m, r, vl, vr, val);
  sum[v] = sum[2 * v] + sum[2 * v + 1];
  mn[v] = min(mn[2 * v], mn[2 * v + 1]);
}
long long find(long long v, long long l, long long r, long long val) {
  push(v, l, r);
  if (l == r - 1) return l;
  long long m = (l + r) / 2;
  push(2 * v, l, m);
  if (mn[2 * v] < val)
    return find(2 * v, l, m, val);
  else
    return find(2 * v + 1, m, r, val);
}
long long tr(long long v, long long l, long long r, long long pos,
             long long &val) {
  push(v, l, r);
  if (mn[v] > val || r <= pos) return 0;
  if (l == r - 1) {
    if (sum[v] <= val) {
      val -= sum[v];
      return 1;
    } else
      return 0;
  }
  long long m = (l + r) / 2;
  if (l >= pos) {
    push(2 * v, l, m);
    long long res = 0;
    if (sum[2 * v] <= val) {
      res += m - l;
      val -= sum[2 * v];
    } else
      res += tr(2 * v, l, m, pos, val);
    res += tr(2 * v + 1, m, r, pos, val);
    return res;
  } else {
    long long res = tr(2 * v, l, m, pos, val);
    res += tr(2 * v + 1, m, r, pos, val);
    return res;
  }
}
void print(long long v, long long l, long long r) {
  push(v, l, r);
  if (l == r - 1) {
    cout << sum[v] << ' ';
    return;
  }
  long long m = (l + r) / 2;
  print(2 * v, l, m);
  print(2 * v + 1, m, r);
}
void solve() {
  cin >> n >> q;
  for (long long i = 0; i < n; i++) cin >> a[i];
  build(1, 0, n);
  while (q--) {
    long long t, first, val;
    cin >> t >> first >> val;
    first--;
    if (t == 1) {
      push(1, 0, n);
      if (mn[1] >= val) continue;
      long long id = find(1, 0, n, val);
      if (id <= first) update(1, 0, n, id, first + 1, val);
    } else {
      long long can = tr(1, 0, n, first, val);
      cout << can << '\n';
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
