#include <bits/stdc++.h>
using namespace std;
inline void rd(int &x) {
  x = 0;
  char ch = getchar();
  int f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int K = 30;
int n, q;
int a[20005], b[20005];
int anc[20005][15][31];
int to[31];
void trans(int *way, int D) {
  for (int i = (0); i <= (K); ++i) {
    for (int j = (K - i); j >= (0); --j)
      way[i + j] = max(way[i + j], anc[way[i]][D][j]);
  }
}
int merge(int x, int y) { return b[x] > b[y] ? x : y; }
int rmq[20005][15], LG[20005];
int calc(int l, int r) {
  int t = LG[r - l + 1];
  return merge(rmq[l][t], rmq[r - (1 << t) + 1][t]);
}
int kth;
int l, r;
bool Judge(int *way) {
  for (int i = (0); i <= (kth); ++i)
    if (way[i] + a[way[i]] + kth - i >= r) return true;
  return false;
}
int hh[31], hhh[31];
int main() {
  rd(n);
  rd(q);
  for (int i = (2); i <= (n); ++i) LG[i] = LG[i >> 1] + 1;
  for (int i = (1); i <= (n); ++i) {
    rd(a[i]);
    b[i] = i + a[i];
  }
  for (int i = (1); i <= (n); ++i) rmq[i][0] = i;
  for (int j = (1); j <= (14); ++j)
    for (int i = (1); i <= (n - (1 << j) + 1); ++i)
      rmq[i][j] = merge(rmq[i][j - 1], rmq[i + (1 << (j - 1))][j - 1]);
  for (int i = (1); i <= (n); ++i) {
    for (int j = (0); j <= (K); ++j) anc[i][0][j] = calc(i, min(b[i] + j, n));
  }
  for (int i = (n); i >= (1); --i)
    for (int j = (1); j <= (14); ++j) {
      for (int k = (0); k <= (K); ++k) anc[i][j][k] = anc[i][j - 1][k];
      trans(anc[i][j], j - 1);
    }
  for (int tt = (1); tt <= (q); ++tt) {
    rd(l);
    rd(r);
    rd(kth);
    if (l + a[l] + kth >= r) {
      if (l == r)
        puts("0");
      else
        puts("1");
    } else {
      for (int i = (0); i <= (K); ++i) hh[i] = l;
      int res = 0;
      for (int D = (14); D >= (0); --D) {
        for (int i = (0); i <= (K); ++i) hhh[i] = hh[i];
        trans(hhh, D);
        if (!Judge(hhh)) {
          for (int i = (0); i <= (K); ++i) hh[i] = hhh[i];
          res += (1 << D);
        }
      }
      printf("%d\n", res + 2);
    }
  }
  return 0;
}
