import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto a = readln.splitter.map !(to !(int)).array;
		auto x = readln.strip.to !(int);

		auto f = new int [4] [n + 1];
		f[0][0] = 0;
		foreach (i; 0..n)
		{
			f[i + 1][0] = f[i][].maxElement;
			f[i + 1][1] = f[i][0] + 1;
			if (i >= 1 &&
			    a[i] + a[i - 1] >= x * 2)
			{
				f[i + 1][2] = f[i][1] + 1;
				if (i >= 2 &&
				    a[i] + a[i - 1] + a[i - 2] >= x * 3)
				{
					f[i + 1][3] =
					    f[i][2..$].maxElement + 1;
				}
			}
		}
		f[n][].maxElement.writeln;
	}
}
