#include <bits/stdc++.h>
const int N = 2e4 + 10, K = 31;
int rin(int &r) {
  int c = getchar();
  r = 0;
  while (c < '0' || '9' < c) c = getchar();
  while ('0' <= c && c <= '9') r = r * 10 + (c ^ '0'), c = getchar();
  return r;
}
int num[N], mxi[N][20], elg2[N], jump[20][N][K], far[20][N][K];
int n, m;
int better(const int &p, const int &q) {
  if (num[p] + p == num[q] + q) return p < q ? q : p;
  return num[p] + p > num[q] + q ? p : q;
}
void init() {
  for (int i = 2; i < N; ++i) elg2[i] = elg2[i >> 1] + 1;
}
int getBest(const int &le, const int &ri) {
  int k = elg2[ri - le + 1];
  return better(mxi[ri][k], mxi[le + (1 << k) - 1][k]);
}
int main() {
  init();
  rin(n), rin(m);
  for (int i = 1; i <= n; ++i) rin(num[i]);
  for (int i = 1; i <= n; ++i) {
    mxi[i][0] = i;
    for (int j = 1; (1 << j) <= i; ++j)
      mxi[i][j] = better(mxi[i - (1 << (j - 1))][j - 1], mxi[i][j - 1]);
  }
  for (int i = 1; i <= n; ++i)
    for (int k = 0; k < K; ++k)
      jump[0][i][k] = getBest(i, std::min(i + k + num[i], n));
  for (int t = 1; t < 20; ++t)
    for (int i = 1; i <= n; ++i)
      for (int k = 0; k < K; ++k) {
        jump[t][i][k] = i;
        for (int w = 0; w <= k; ++w) {
          int mid = jump[t - 1][i][w];
          jump[t][i][k] = better(jump[t][i][k], jump[t - 1][mid][k - w]);
        }
      }
  for (int i = 1; i <= n; ++i)
    for (int k = 0; k < K; ++k) far[0][i][k] = std::min(n, i + k + num[i]);
  for (int t = 1; t < 20; ++t)
    for (int i = 1; i <= n; ++i)
      for (int k = 0; k < K; ++k) {
        far[t][i][k] = i;
        for (int w = 0; w <= k; ++w) {
          int mid = jump[t - 1][i][w];
          far[t][i][k] = std::max(far[t][i][k], far[t - 1][mid][k - w]);
        }
      }
  while (m--) {
    int le, ri, nk;
    rin(le), rin(ri), rin(nk);
    if (le == ri) {
      printf("0\n");
      continue;
    }
    if (le + nk + num[le] >= ri) {
      printf("1\n");
      continue;
    }
    int cur = le, rem = nk, ans = 0;
    for (int t = 19; ~t; --t)
      if (far[t][cur][rem] < ri) {
        ans += 1 << t;
        int delt = 0;
        for (int k = 0; k <= rem; ++k) {
          int mid = jump[t][cur][k];
          if (far[t][mid][rem - k] >= ri && mid > cur) cur = mid, delt = k;
        }
        rem -= delt;
      }
    ++ans;
    printf("%d\n", ans);
  }
  return 0;
}
