#include <bits/stdc++.h>
using namespace std;
const long long INF = LLONG_MAX;
const long long mod = 1000000007;
const double pi = 3.14159265358979323846;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long divmod(long long a, long long b) {
  return a * powmod(b, mod - 2) % mod;
}
const int nax = 2e5 + 10;
long long sum[4 * nax];
long long mn[4 * nax];
long long mx[4 * nax];
long long lazy[4 * nax];
void build(vector<long long>& arr, int id, int tl, int tr) {
  if (tr - tl == 1) {
    mn[id] = mx[id] = sum[id] = arr[tl];
  } else {
    int mid = (tr + tl) / 2;
    build(arr, id * 2, tl, mid);
    build(arr, id * 2 + 1, mid, tr);
    mn[id] = min(mn[id * 2], mn[id * 2 + 1]);
    mx[id] = max(mx[id * 2], mx[id * 2 + 1]);
    sum[id] = sum[id * 2] + sum[id * 2 + 1];
  }
}
void add_lazy(int id, long long len, long long val) {
  mn[id] = val;
  mx[id] = val;
  sum[id] = val * len;
  lazy[id] = val;
}
void shift(int id, int tl, int tr) {
  if (!lazy[id]) return;
  int mid = (tl + tr) / 2;
  add_lazy(id * 2, mid - tl, lazy[id]);
  add_lazy(id * 2 + 1, tr - mid, lazy[id]);
  lazy[id] = 0;
}
void update(int id, int tl, int tr, int pos, long long val) {
  if (pos <= tl || mn[id] >= val) return;
  if (tr <= pos && mx[id] <= val) {
    add_lazy(id, tr - tl, val);
    return;
  }
  shift(id, tl, tr);
  int mid = (tl + tr) / 2;
  update(id * 2, tl, mid, pos, val);
  update(id * 2 + 1, mid, tr, pos, val);
  mn[id] = min(mn[id * 2], mn[id * 2 + 1]);
  mx[id] = max(mx[id * 2], mx[id * 2 + 1]);
  sum[id] = sum[id * 2] + sum[id * 2 + 1];
}
long long sumQuery(int id, int tl, int tr, int l, int r) {
  if (r <= tl || tr <= l) return 0;
  if (l <= tl && tr <= r) {
    return sum[id];
  }
  shift(id, tl, tr);
  int mid = (tl + tr) / 2;
  return sumQuery(id * 2, tl, mid, l, r) + sumQuery(id * 2 + 1, mid, tr, l, r);
}
long long minQuery(int id, int tl, int tr, int l, int r) {
  if (r <= tl || tr <= l) return INT_MAX;
  if (l <= tl && tr <= r) {
    return mn[id];
  }
  shift(id, tl, tr);
  int mid = (tl + tr) / 2;
  return min(minQuery(id * 2, tl, mid, l, r),
             minQuery(id * 2 + 1, mid, tr, l, r));
}
int binarySearch1(int x, long long money, int n) {
  int l = x;
  int r = n + 1;
  while (l < r) {
    int mid = (l + r) / 2;
    if (minQuery(1, 1, n + 1, 1, mid + 1) <= money)
      r = mid;
    else
      l = mid + 1;
  }
  return l;
}
int binarySearch2(int start, long long money, int n) {
  int l = start + 1;
  int r = n + 1;
  while (l < r) {
    int mid = (l + r + 1) / 2;
    if (sumQuery(1, 1, n + 1, start, mid) <= money)
      l = mid;
    else
      r = mid - 1;
  }
  return l;
}
int query2(int id, int tl, int tr, int l, int r, long long& val) {
  if (val < mn[id]) return 0;
  if (r <= tl || tr <= l) return 0;
  if (l <= tl && tr <= r && sum[id] <= val) {
    val -= sum[id];
    return tr - tl;
  }
  shift(id, tl, tr);
  int mid = (tl + tr) / 2;
  return query2(id * 2, tl, mid, l, r, val) +
         query2(id * 2 + 1, mid, tr, l, r, val);
}
void solve() {
  int n, q;
  cin >> n >> q;
  vector<long long> a(n + 2);
  for (int i = (1); i < (n + 1); ++i) cin >> a[i];
  build(a, 1, 1, n + 1);
  for (int i = (0); i < (q); ++i) {
    int type, x;
    long long y;
    cin >> type >> x >> y;
    if (type == 1) {
      update(1, 1, n + 1, x + 1, y);
    } else {
      cout << query2(1, 1, n + 1, x, n + 1, y) << endl;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
