#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m;
struct node {
  long long mx;
  long long sum;
  long long tag;
  long long mn;
} tree[800100];
void pushup(int now) {
  tree[now].mx = max(tree[now << 1].mx, tree[now << 1 | 1].mx);
  tree[now].sum = tree[now << 1].sum + tree[now << 1 | 1].sum;
  tree[now].mn = min(tree[now << 1].mn, tree[now << 1 | 1].mn);
}
void pushdown(int now, int s, int t) {
  if (!tree[now].tag) return;
  tree[now << 1].mx = tree[now].tag;
  tree[now << 1 | 1].mx = tree[now].tag;
  int mid = (s + t) >> 1;
  tree[now << 1].sum = tree[now].tag * (mid - s + 1);
  tree[now << 1 | 1].sum = tree[now].tag * (t - mid);
  tree[now << 1].mn = tree[now].tag;
  tree[now << 1].tag = tree[now].tag;
  tree[now << 1 | 1].tag = tree[now].tag;
  tree[now].tag = 0;
}
void build(int s, int t, int now) {
  if (s == t) {
    tree[now].mn = tree[now].mx = tree[now].sum = read();
    tree[now].tag = false;
    return;
  }
  int mid = (s + t) >> 1;
  build(s, mid, now << 1);
  build(mid + 1, t, now << 1 | 1);
  pushup(now);
}
long long ask(int pos, int s, int t, int now) {
  if (s == t) {
    return tree[now].mx;
  }
  int mid = (s + t) >> 1;
  pushdown(now, s, t);
  if (pos <= mid) {
    return ask(pos, s, mid, now << 1);
  } else {
    return ask(pos, mid + 1, t, now << 1 | 1);
  }
}
long long ans = 0;
long long ask(int l, int r, int s, int t, int now, long long money) {
  if (money >= tree[now].sum && l <= s && t <= r) {
    ans += t - s + 1;
    return money - tree[now].sum;
  }
  if (money < tree[now].mn) return money;
  if (s == t) return money;
  pushdown(now, s, t);
  int mid = (s + t) >> 1;
  if (l <= mid) money = ask(l, r, s, mid, now << 1, money);
  if (r > mid) money = ask(l, r, mid + 1, t, now << 1 | 1, money);
  return money;
}
void change(int l, int r, int s, int t, int now, long long val) {
  if (l <= s && t <= r) {
    tree[now].mx = val;
    tree[now].sum = (t - s + 1) * val;
    tree[now].tag = val;
    tree[now].mn = val;
    return;
  }
  int mid = (s + t) >> 1;
  pushdown(now, s, t);
  if (l <= mid) {
    change(l, r, s, mid, now << 1, val);
  }
  if (r > mid) {
    change(l, r, mid + 1, t, now << 1 | 1, val);
  }
  pushup(now);
}
int main() {
  int n = read(), q = read() + 1;
  build(1, n, 1);
  while (--q) {
    int op = read();
    if (op == 1) {
      long long x = read(), y = read();
      long long l = 1, r = x + 1;
      while (l < r) {
        int mid = (l + r) >> 1;
        if (ask(mid, 1, n, 1) < y) {
          r = mid;
        } else {
          l = mid + 1;
        }
      }
      if (l == x + 1) continue;
      change(l, x, 1, n, 1, y);
    } else {
      long long x = read(), y = read();
      ans = 0;
      ask(x, n, 1, n, 1, y);
      cout << ans << endl;
    }
  }
}
