#include <bits/stdc++.h>
using namespace std;
void Max(int &x, int y) { (x < y) && (x = y); }
void Min(int &x, int y) { (x > y) && (x = y); }
bool vio;
char IO;
int rd(int res = 0) {
  bool f = 0;
  while (IO = getchar(), IO < 48 || IO > 57) f = IO == '-';
  do res = (res << 1) + (res << 3) + (IO ^ 48);
  while (IO = getchar(), isdigit(IO));
  return f ? -res : res;
}
const int M = 20005;
int fa[M][21][31], n, q, A[M], p[33];
int Mx(int &x, int y) { return x + A[x] > y + A[y] ? x : y; }
struct ST {
  int f[22][M], lg[M];
  void build() {
    for (int i = 2, iend = n; i <= iend; ++i) lg[i] = lg[i >> 1] + 1;
    for (int i = 1, iend = n; i <= iend; ++i) f[0][i] = i;
    for (int j = 1, jend = 20; j <= jend; ++j)
      for (int i = 1, iend = n; i <= iend; ++i)
        f[j][i] = Mx(f[j - 1][i], f[j - 1][i + (1 << (j - 1))]);
  }
  int qry(int l, int r) {
    int t = lg[r - l + 1];
    return Mx(f[t][l], f[t][r - (1 << t) + 1]);
  }
} T;
bool let;
int main() {
  cerr << (&vio - &let) / 1024.0 / 1024 << endl;
  n = rd(), q = rd();
  for (int i = 1, iend = n; i <= iend; ++i) A[i] = min(n - i, rd());
  T.build();
  for (int i = 1, iend = n; i <= iend; ++i) {
    fa[i][0][0] = T.qry(i, i + A[i]);
    for (int j = 1, jend = 30; j <= jend; ++j)
      fa[i][0][j] = min(i + j + A[i], n);
  }
  for (int j = 1, jend = 20; j <= jend; ++j)
    for (int k = 0, kend = 30; k <= kend; ++k)
      for (int i = 1, iend = n; i <= iend; ++i)
        for (int t = 0, tend = k; t <= tend; ++t)
          fa[i][j][k] = Mx(fa[i][j][k], fa[fa[i][j - 1][t]][j - 1][k - t]);
  while (q--) {
    int l = rd(), r = rd(), t = rd();
    if (l == r) {
      puts("0");
      continue;
    }
    if (l + t + A[l] >= r) {
      puts("1");
      continue;
    }
    int ans = 2;
    for (int i = 0, iend = 30; i <= iend; ++i) p[i] = l;
    for (int i = 20, iend = 0; i >= iend; --i) {
      bool fl = 1;
      for (int j = 0, jend = 30; j <= jend; ++j)
        for (int k = 0, kend = t - j; k <= kend; ++k)
          if (fa[p[k]][i][j] + A[fa[p[k]][i][j]] + j >= r) {
            fl = 0;
            break;
          }
      if (!fl) continue;
      ans += 1 << i;
      for (int j = 30, jend = 0; j >= jend; --j)
        for (int k = t - j, kend = 0; k >= kend; --k)
          p[k + j] = Mx(p[k + j], fa[p[j]][i][k]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
