#include <bits/stdc++.h>
using namespace std;
const int N = 20005, K = 20;
int n, Q, a[N], lg[N], mx[N][K], f[N][K][35];
int mymax(int i, int j) { return i + a[i] > j + a[j] ? i : j; }
int ask(int l, int r) {
  int x = lg[r - l + 1];
  return mymax(mx[l][x], mx[r - (1 << x) + 1][x]);
}
int main() {
  for (int i = (2); i <= (N - 1); ++i) lg[i] = lg[i >> 1] + 1;
  scanf("%d%d", &n, &Q);
  for (int i = (1); i <= (n); ++i) scanf("%d", &a[i]), mx[i][0] = i;
  for (int j = (1); j <= (K - 1); ++j) {
    for (int i = (1); i <= (n - (1 << j) + 1); ++i)
      mx[i][j] = mymax(mx[i][j - 1], mx[i + (1 << (j - 1))][j - 1]);
  }
  for (int i = (1); i <= (n); ++i) f[i][0][0] = min(n, i + a[i]);
  for (int k = (1); k <= (30); ++k) {
    for (int i = (1); i <= (n); ++i) {
      f[i][0][k] = min(n, i + a[i] + k);
    }
    for (int j = (1); j <= (K - 1); ++j) {
      for (int i = (1); i <= (n); ++i) {
        int pos = ask(i, f[i][j - 1][k]);
        for (int t = (0); t <= (k); ++t) {
          f[i][j][k] = max(f[i][j - 1][k], f[pos][j - 1][k - t]);
        }
      }
    }
  }
  while (Q--) {
    int l, r, k;
    scanf("%d%d%d", &l, &r, &k);
    if (l == r) {
      puts("0");
      continue;
    }
    if (l + a[l] + k >= r) {
      puts("1");
      continue;
    }
    static int dp[35], _dp[35];
    memset(dp, 0, sizeof(dp));
    int now = 1;
    for (int i = (0); i <= (k); ++i) dp[i] = f[l][0][i];
    for (int i = (K - 1); i >= (0); --i) {
      memcpy(_dp, dp, sizeof(_dp));
      for (int j = (0); j <= (k); ++j) {
        assert(l <= dp[j]);
        int pos = ask(l, dp[j]);
        for (int t = (0); t <= (k); ++t) {
          _dp[j + t] = max(_dp[j + t], f[pos][i][t]);
        }
      }
      if (_dp[k] >= r) {
      } else {
        now += 1 << k;
        for (int j = (0); j <= (k); ++j) dp[j] = _dp[j];
      }
    }
    printf("%d\n", now + 1);
  }
  return 0;
}
