#include<bits/stdc++.h>
using namespace std;
#define Re register int

const int N = 20005;
int n, q, t, ans, a[N], g[N], h[32][N], d[32], f[16][32][N];

inline int read()
{
	char c = getchar();
	int ans = 0;
	while (c < 48 || c > 57) c = getchar();
	while (c >= 48 && c <= 57) ans = (ans << 3) + (ans << 1) + (c ^ 48), c = getchar();
	return ans;
}

inline void write(int x)
{
	int num = 0;
	char sc[15];
	while (x) sc[++num] = x % 10 + 48, x /= 10;
	while (num) putchar(sc[num--]);
	putchar('\n');
}

inline int Max(int x, int y)
{
	return a[x] > a[y] ? x : y;
}

inline int min(int x, int y)
{
	return x < y ? x : y;
}

int main()
{
	n = read(), q = read();
	for (Re i = 1; i <= n; ++i) a[i] = i + read();
	for (Re i = n; i; --i)
	{
		while (t && a[g[t]] <= a[i]) --t;
		g[++t] = i;
		int l = 1, r = t - 1, s = t;
		while (l <= r)
		{
			int mid = l + r >> 1;
			if (g[mid] <= a[i]) s = mid, r = mid - 1;
			else l = mid + 1;
		}
		f[0][0][i] = g[s], h[0][i] = i;
		for (Re j = 1; j <= 30; ++j)
			h[j][i] = Max(h[j - 1][i], min(i + j, n)), f[0][j][i] = Max(Max(g[s], h[j][min(a[i], n)]), Max(f[0][j - 1][i], f[0][j - 1][i + 1]));
	}	
	for (Re i = 1; (1 << i) <= n; ++i)
	{
		t = i;
		for (Re j = 0; j <= 30; ++j)
			for (Re k = 1; k <= n; ++k)
				for (Re t = 0; t <= j; ++t)
					f[i][j][k] = Max(f[i][j][k], Max(f[i - 1][t][k], f[i - 1][j - t][f[i - 1][t][k]]));
	}
	while (q--)
	{
		int u = read(), v = read(), w = read();
		if (u == v)
		{
			puts("0");
			continue;
		}
		if (a[u] + w >= v)
		{
			puts("1");
			continue;
		}
		ans = 2;
		for (Re i = 0; i <= w; ++i) d[i] = f[0][i][u];
		for (Re i = t; i >= 0; --i)
		{
			bool p = 0;
			for (Re j = 0; j <= w && !p; ++j)
				if (a[f[i][w - j][d[j]]] >= v) p = 1;
			if (p) continue;
			ans += 1 << i;
			for (Re j = w; j >= 0; --j)
				for (Re k = j; k >= 0; --k) d[j] = Max(d[j], f[i][j - k][d[k]]);
		}
		bool p = 0;
		for (Re i = 0; i <= w && !p; ++i)
			if (a[d[i]] >= v) p = 1;
		ans += p ^ 1;
		write(ans);
	}
	return 0;
}
