#include <bits/stdc++.h>
using namespace std;
int read() {
  int tot = 0, fh = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') fh = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    tot = tot * 10 + c - '0';
    c = getchar();
  }
  return tot * fh;
}
void getstr(char *a) {
  char c = getchar();
  int len = 0;
  while (!((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ||
           (c >= '0' && c <= '9')))
    c = getchar();
  while ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ||
         (c >= '0' && c <= '9')) {
    a[++len] = c;
    c = getchar();
  }
}
const int maxn = 200100;
int n, t, q, ans, block, num, belong[maxn];
long long a[maxn], L[2000], R[2000], sum[2000], tag[2000];
void build() {
  block = sqrt(n);
  num = n / block;
  if (num * block != n) num++;
  for (int i = 1; i <= num; i++) {
    L[i] = block * (i - 1) + 1;
    R[i] = block * i;
    R[num] = n;
    for (int j = L[i]; j <= R[i]; j++) {
      belong[j] = i;
      sum[i] += a[j];
    }
  }
}
int fd(int l, int r, int lim) {}
int main() {
  n = read();
  q = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  build();
  while (q--) {
    t = read();
    if (t == 1) {
      int x = read();
      long long y = read();
      for (int i = 1; i < belong[x]; i++)
        if (tag[i] == 0) {
          if (a[R[i]] < y) {
            if (a[L[i]] <= y) {
              tag[i] = y;
              sum[i] = (R[i] - L[i] + 1ll) * tag[i];
            } else {
              sum[i] = 0;
              for (int j = L[i]; j <= R[i]; j++) {
                a[j] = max(a[j], y);
                sum[i] += a[j];
              }
            }
          }
        } else {
          if (tag[i] < y) {
            tag[i] = y;
            sum[i] = (R[i] - L[i] + 1ll) * tag[i];
          }
        }
      int cur = belong[x];
      sum[cur] = 0;
      for (int i = L[cur]; i <= R[cur]; i++)
        if (i <= x) {
          a[i] = max(a[i], max(y, tag[cur]));
          sum[cur] += a[i];
        } else {
          a[i] = max(a[i], tag[cur]);
          sum[cur] += a[i];
        }
      tag[cur] = 0;
    } else {
      int x = read();
      long long y = read();
      ans = 0;
      int cur = belong[x];
      for (int i = x; i <= R[cur]; i++) {
        long long tmp = max(tag[cur], a[i]);
        if (y >= tmp) {
          y -= tmp;
          ans++;
          tmp = max(tag[cur], a[R[cur]]);
          if (tmp > y) break;
        }
      }
      for (int i = belong[x] + 1; i <= num; i++) {
        long long tmp = sum[i];
        if (y >= tmp) {
          y -= tmp;
          ans += R[i] - L[i] + 1;
        } else {
          tmp = max(tag[i], a[R[i]]);
          if (tmp > y) continue;
          for (int j = L[i]; j <= R[i]; j++) {
            tmp = max(tag[i], a[j]);
            if (y >= tmp) {
              y -= tmp;
              ans++;
              tmp = max(tag[i], a[R[i]]);
              if (tmp > y) break;
            }
          }
        }
      }
      cout << ans << endl;
    }
  }
  return 0;
}
