#include <bits/stdc++.h>
inline void read(char &x) {
  do x = getchar();
  while (x <= ' ');
}
inline void read(char *s) {
  char ch;
  do ch = getchar();
  while (ch <= ' ');
  while (ch > ' ') {
    (*s) = ch;
    s++;
    ch = getchar();
  }
  (*s) = 0;
}
inline void read(std::string &s) {
  char ch;
  do ch = getchar();
  while (ch <= ' ');
  while (ch > ' ') {
    s.push_back(ch);
    ch = getchar();
  }
}
template <class A>
inline void readint(A &x) {
  bool neg = false;
  char ch;
  do ch = getchar();
  while (ch <= ' ');
  if (ch == '-') {
    neg = true;
    ch = getchar();
  }
  x = 0;
  while (ch > ' ') {
    x = x * 10 + (ch & 15);
    ch = getchar();
  }
  if (neg) x = -x;
}
inline void read(int &x) { readint(x); }
inline void read(long long &x) { readint(x); }
template <class A, class B>
inline void read(A &a, B &b) {
  read(a);
  read(b);
}
template <class A, class B, class C>
inline void read(A &a, B &b, C &c) {
  read(a);
  read(b);
  read(c);
}
template <class A, class B, class C, class D>
inline void read(A &a, B &b, C &c, D &d) {
  read(a);
  read(b);
  read(c);
  read(d);
}
inline void writeln() { putchar('\n'); }
template <class A>
inline void writeint(A x) {
  static char buf[20];
  int top = 0;
  if (!x) {
    putchar('0');
    return;
  }
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  while (x) {
    buf[++top] = (x % 10) | 48;
    x /= 10;
  }
  while (top) putchar(buf[top--]);
}
inline void write(int x) { writeint(x); }
inline void write(unsigned x) { writeint(x); }
inline void write(long long x) { writeint(x); }
inline void write(unsigned long long x) { writeint(x); }
inline void write(char ch) { putchar(ch); }
inline void write(char *s) {
  while (*s) {
    putchar(*s);
    s++;
  }
}
inline void write(const char *s) { printf(s); }
template <class A>
inline void write_(A x) {
  write(x);
  putchar(' ');
}
template <class A>
inline void writeln(A x) {
  write(x);
  putchar('\n');
}
template <class A, class B>
inline void write(A a, B b) {
  write_(a);
  write(b);
}
template <class A, class B>
inline void writeln(A a, B b) {
  write_(a);
  writeln(b);
}
template <class A, class B, class C>
inline void writeln(A a, B b, C c) {
  write_(a);
  write_(b);
  writeln(c);
}
template <class A, class B, class C, class D>
inline void writeln(A a, B b, C c, D d) {
  write_(a);
  write_(b);
  write_(c);
  writeln(d);
}
const int N = 2e5 + 10;
int n, q;
int a[N];
int maxv[N << 2], minv[N << 2], mark[N << 2];
long long sum[N << 2];
inline void updnode(int p, int l, int r, int x) {
  maxv[p] = minv[p] = mark[p] = x;
  sum[p] = (r - l + 1LL) * x;
}
inline void down(int p, int l, int r) {
  if (mark[p]) {
    updnode((p << 1), l, ((l + r) >> 1), mark[p]);
    updnode((p << 1 | 1), ((l + r) >> 1) + 1, r, mark[p]);
    mark[p] = 0;
  }
}
inline void up(int p) {
  maxv[p] = std::max(maxv[(p << 1)], maxv[(p << 1 | 1)]);
  minv[p] = std::min(minv[(p << 1)], minv[(p << 1 | 1)]);
  sum[p] = sum[(p << 1)] + sum[(p << 1 | 1)];
}
void build(int p, int l, int r) {
  if (l ^ r) {
    build((p << 1), l, ((l + r) >> 1));
    build((p << 1 | 1), ((l + r) >> 1) + 1, r);
    up(p);
  } else
    minv[p] = maxv[p] = sum[p] = a[l];
}
void update(int p, int l, int r, int b, int x) {
  if (minv[p] >= x) return;
  if (r <= b and maxv[p] <= x) {
    updnode(p, l, r, x);
    return;
  }
  down(p, l, r);
  update((p << 1), l, ((l + r) >> 1), b, x);
  if (b > ((l + r) >> 1)) update((p << 1 | 1), ((l + r) >> 1) + 1, r, b, x);
  up(p);
}
void query(int p, int l, int r, int a, int &x, int &cnt) {
  if (minv[p] > x) return;
  if (a <= l and x >= sum[p]) {
    x -= sum[p];
    cnt += r - l + 1;
    return;
  }
  down(p, l, r);
  if (a <= ((l + r) >> 1)) query((p << 1), l, ((l + r) >> 1), a, x, cnt);
  query((p << 1 | 1), ((l + r) >> 1) + 1, r, a, x, cnt);
}
int main() {
  int i;
  int opt, x, y, ans;
  read(n, q);
  for (i = int(1); i <= int(n); i++) read(a[i]);
  build(1, 1, n);
  for (i = int(1); i <= int(q); i++) {
    read(opt, x, y);
    if (opt == 1)
      update(1, 1, n, x, y);
    else {
      ans = 0;
      query(1, 1, n, x, y, ans);
      writeln(ans);
    }
  }
  return 0;
}
