There are $n$ piles of sand where the $i$-th pile has $a_i$ blocks of sand. The $i$-th pile is called too tall if $1 < i < n$ and $a_i > a_{i-1} + a_{i+1}$. That is, a pile is too tall if it has more sand than its two neighbours combined. (Note that piles on the ends of the array cannot be too tall.)

You are given an integer $k$. An operation consists of picking $k$ consecutive piles of sand and adding one unit of sand to them all. Formally, pick $1 \leq l,r \leq n$ such that $r-l+1=k$. Then for all $l \leq i \leq r$, update $a_i \gets a_i+1$.

What is the maximum number of piles that can simultaneously be too tall after some (possibly zero) operations?


-----Input-----

The input consists of multiple test cases. The first line contains an integer $t$ ($1 \leq t \leq 1000$) — the number of test cases. The description of the test cases follows.

The first line of each test case contains two integers $n$ and $k$ ($3 \leq n \leq 2 \cdot 10^5$; $1 \leq k \leq n$) — the number of piles of sand and the size of the operation, respectively.

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the sizes of the piles.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.


-----Output-----

For each test case, output a single integer — the maximum number of piles that are simultaneously too tall after some (possibly zero) operations.


-----Examples-----

Input
3
5 2
2 9 2 4 1
4 4
1 3 2 1
3 1
1 3 1
Output
2
0
1


-----Note-----

In the first test case, we can perform the following three operations:

Add one unit of sand to piles $1$ and $2$: $[{3}, {10}, 2, 4, 1]$.

Add one unit of sand to piles $4$ and $5$: $[3, 10, 2, {5}, {2}]$.

Add one unit of sand to piles $3$ and $4$: $[3, 10, {3}, {6}, 2]$.

Now piles $2$ and $4$ are too tall, so in this case the answer is $2$. It can be shown that it is impossible to make more than $2$ piles too tall.

In the second test case, any operation will increase all piles by $1$ unit, so the number of too tall piles will always be $0$.

In the third test case, we can increase any pile by $1$ unit of sand. It can be shown that the maximum number of too tall piles is $1$.

Difficulty: EASY

Solutions:
z = lambda : map(int, input().split())
(t,) = z()
for _ in '_' * t:
	(n, k) = z()
	l = [*z()]
	if k != 1:
		print(sum((x + y < z for (x, z, y) in zip(l, l[1:], l[2:]))))
	else:
		print((n - 1) // 2)


def soln():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	if k == 1:
		print((n - 1) // 2)
		return
	for i in range(1, n - 1):
		if a[i] > a[i - 1] + a[i + 1]:
			ans += 1
	print(ans)
for _ in range(int(input())):
	soln()


def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		l = list(map(int, input().split()))
		c = 0
		if k == 1:
			if n % 2 == 0:
				print((n - 1) // 2)
			else:
				print(n // 2)
		else:
			for i in range(1, n - 1):
				if l[i] > l[i - 1] + l[i + 1]:
					c += 1
			print(c)
main()


def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k == 1:
		print((n - 1) // 2)
	else:
		ans = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				ans += 1
		print(ans)
for _ in range(int(input())):
	main()


def main():
	N = int(input())
	for _ in range(N):
		(_, k) = map(int, input().split())
		arr = list(map(int, input().split()))
		if k == 1:
			print((len(arr) - 1) // 2)
			continue
		ans = 0
		for i in range(1, len(arr) - 1):
			if arr[i] > arr[i - 1] + arr[i + 1]:
				ans += 1
		print(ans)

def init():
	import os
	import sys
	sys.setrecursionlimit(2 * 10 ** 6)
	if 'CP_LOCAL_ENV' in os.environ:
		sys.stdin = open('cf_test_b.txt')
init()
main()


def currentTall(l, n):
	x = 0
	for i in range(1, n - 1):
		if l[i] > l[i + 1] + l[i - 1]:
			x += 1
	return x
t = int(input())
for j in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k == 1:
		tall = (n - 1) // 2
	else:
		tall = currentTall(a, n)
	print(tall)


import sys
input = sys.stdin.readline

def solve():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	if k == 1:
		return n // 2 if n % 2 else n // 2 - 1
	else:
		cnt = 0
		for i in range(1, n - 1):
			if arr[i] > arr[i - 1] + arr[i + 1]:
				cnt += 1
		return cnt
for _ in range(int(input())):
	print(solve())


def hig(x, y):
	ans = 0
	for i in range(1, y - 1):
		if x[i] > x[i - 1] + x[i + 1]:
			ans += 1
	return ans
for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k == 1:
		print((n - 1) // 2)
	else:
		print(hig(a, n))


T = int(input())
q = []
for i in range(T):
	x = input().split()
	(n, k) = (int(x[0]), int(x[1]))
	data = [int(i) for i in input().split()]
	q.append((n, k, data))

def solve(n, k, data):
	if k == 1:
		print((n + 1) // 2 - 1)
		return
	ans = 0
	for i in range(1, n - 1):
		if data[i] > data[i - 1] + data[i + 1]:
			ans += 1
	print(ans)
for (n, k, data) in q:
	solve(n, k, data)


def solv():
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	a = input().split()
	a = [int(i) for i in a]
	if k == 1:
		return (n - 2 + 1) // 2
	else:
		ans = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				ans += 1
		return ans
inp = input()
for i in range(int(inp)):
	print(solv())


import math
from collections import Counter
ints = lambda : list(map(int, input().split()))
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
mx = 10 ** 5
inp = lambda : int(input())

def xor_mix():
	n = inp()
	arr = ints()
	for i in range(n):
		x = arr[i]
		bit_xor = 0
		for elem in arr[:i] + arr[i + 1:]:
			bit_xor ^= elem
		if bit_xor == x:
			print(x)
			break

def rising_sand():
	(n, k) = ints()
	arr = ints()
	if n <= 2:
		print(0)
	elif k == 1:
		print(math.ceil((n - 2) / 2))
	else:
		too_tall = 0
		for i in range(1, n - 1):
			if arr[i] > arr[i + 1] + arr[i - 1]:
				too_tall += 1
		print(too_tall)
n = inp()
for _ in range(n):
	rising_sand()


import math

def tootall(a):
	t = 0
	for i in range(1, len(a) - 1):
		if a[i] > a[i - 1] + a[i + 1]:
			t += 1
	return t
for _ in range(int(input())):
	asdasd = list(map(int, input().split()))
	n = asdasd[0]
	k = asdasd[1]
	p = list(map(int, input().split()))
	if k == 1:
		print(math.floor((n - 1) / 2))
	else:
		print(tootall(p))


def main():
	for t in range(int(input())):
		(n, k) = map(int, input().split())
		a = list(map(int, input().split()))
		if k == 1:
			if n % 2 == 0:
				print(n // 2 - 1)
			else:
				print(n // 2)
			continue
		res = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				res += 1
		print(res)
main()


def solve():
	(n, k) = map(int, input().split())
	lis = list(map(int, input().split()))
	ans = 0
	above_lim = 0
	if k == 1:
		print((n - 1) // 2)
		return
	for i in range(1, n - 1):
		if lis[i] > lis[i - 1] + lis[i + 1]:
			ans += 1
	print(ans)
for _ in range(int(input())):
	solve()


def prevelike(a, n):
	br = 0
	for i in range(1, n - 1):
		if a[i] > a[i - 1] + a[i + 1]:
			br += 1
	return br
for t in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k == 1:
		print(int(n / 2) - (n + 1) % 2)
	else:
		print(prevelike(a, n))


R = lambda : map(int, input().split())
(t,) = R()
exec(t * 'n,k=R();a=*R(),;print((n-1>>1,sum(y>x+z for x,y,z in zip(a,a[1:],a[2:])))[k>1]);')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k == 1:
		print((n - 1) // 2)
	else:
		print(sum((1 for i in range(1, n - 1) if a[i] > a[i - 1] + a[i + 1])))


def calc_tall(nums):
	return sum((1 for (a, b, c) in zip(nums[:], nums[1:], nums[2:]) if b > a + c))
N = int(input())
for i in range(N):
	(n, k) = list(map(int, input().split()))
	nums = list(map(int, input().split()))
	if k == 1:
		print((n - 1) // 2)
	else:
		print(calc_tall(nums))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	nums = list(map(int, input().split()))
	if k == 1:
		print(n // 2 + n % 2 - 1)
	else:
		ans = 0
		for i in range(1, n - 1):
			if nums[i] > nums[i - 1] + nums[i + 1]:
				ans += 1
		print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	res = 0
	if k == 1:
		print(str((n - 2) // 2 + (n - 2) % 2))
	else:
		for i in range(1, n - 1):
			if arr[i] > arr[i - 1] + arr[i + 1]:
				res += 1
		print(str(res))


def func():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	if k == 1:
		print((n + 1) // 2 - 1)
	else:
		count = 0
		for i in range(1, n - 1):
			if arr[i] > arr[i - 1] + arr[i + 1]:
				count += 1
		print(count)
tc = int(input())
while tc:
	func()
	tc -= 1


num_cases = int(input())
cases = []
for i in range(num_cases):
	nk = list(map(int, input().split()))
	inputs = list(map(int, input().split()))
	cases.append((nk, inputs))
for case in cases:
	(n, k) = case[0]
	ip = case[1]
	ans = 0
	if k == 1:
		ans = int(int(n - 1) / 2)
	else:
		for i in range(1, n - 1):
			if ip[i] > ip[i - 1] + ip[i + 1]:
				ans += 1
	print(ans)


t = int(input())

def solve():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k == 1:
		print((n - 1) // 2)
	else:
		ans = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				ans += 1
		print(ans)
for i in range(t):
	solve()


def solve(arr, n, k):
	if k == 1:
		return (n - 1) // 2
	c = 0
	for i in range(1, n - 1):
		if arr[i] > arr[i - 1] + arr[i + 1]:
			c += 1
	return c

def main():
	t = int(input())
	for i in range(t):
		nk = input().split()
		(n, k) = (int(nk[0]), int(nk[1]))
		s = input().split()
		arr = list(map(int, s))
		res = solve(arr, n, k)
		print(res)
main()


import sys

def func(n, k, arr):
	if k == 1:
		if n % 2 == 0:
			print(n // 2 - 1)
		else:
			print(n // 2)
	else:
		s = 0
		for i in range(1, n - 1):
			if arr[i] > arr[i - 1] + arr[i + 1]:
				s += 1
		print(s)
t = list(map(int, next(sys.stdin).split()))[0]
for _ in range(t):
	(n, k) = tuple(map(int, next(sys.stdin).split()))
	arr = list(map(int, next(sys.stdin).split()))
	func(n, k, arr)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solution(n, k, a):
	if n <= 2:
		return 0
	if k == 1:
		return (n - 1) // 2
	counter = 0
	for i in range(1, n - 1):
		if a[i] > a[i - 1] + a[i + 1]:
			counter += 1
	return counter
tests = inp()
for test in range(tests):
	(n, k) = inlt()
	a = inlt()
	print(solution(n, k, a))


def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		data = list(map(int, input().split()))
		if k == 1:
			print((n - 1) // 2 if n % 2 != 0 else n // 2 - 1)
		else:
			total = 0
			for i in range(1, n - 1):
				if data[i] > data[i - 1] + data[i + 1]:
					total += 1
			print(total)
main()


def treasure():
	count = 0
	(n, k) = map(int, input().split())
	array = list(map(int, input().split()))
	if k == 1:
		count = (n - 1) // 2
		return count
	for i in range(1, len(array) - 1):
		if array[i] > array[i + 1] + array[i - 1]:
			count += 1
	return count
t = int(input())
result = []
for _ in range(t):
	result.append(treasure())
print(*result, sep='\n')


from math import ceil
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k == 1:
		print(ceil((n - 2) / 2))
	else:
		ans = 0
		temp = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				temp += 1
		print(temp)


import sys
input = sys.stdin.readline

def sol():
	ans = 0
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	if k == 1:
		if n & 1:
			return n // 2
		else:
			return n // 2 - 1
	for i in range(1, n - 1):
		if a[i - 1] + a[i + 1] < a[i]:
			ans += 1
	return ans
for _ in range(int(input())):
	print(sol())


import os.path
from math import gcd, floor, ceil
from collections import *
import sys
mod = 1000000007
INF = float('inf')

def st():
	return list(sys.stdin.readline().strip())

def li():
	return list(map(int, sys.stdin.readline().split()))

def mp():
	return map(int, sys.stdin.readline().split())

def inp():
	return int(sys.stdin.readline())

def pr(n):
	return sys.stdout.write(str(n) + '\n')

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = inp()
for _ in range(t):
	(n, k) = mp()
	l = li()
	if k == 1:
		if n % 2 == 0:
			pr(n // 2 - 1)
		else:
			pr(n // 2)
	else:
		c = 0
		for i in range(1, n - 1):
			if l[i] > l[i - 1] + l[i + 1]:
				c += 1
		pr(c)


import math

def task(n, k, a):
	if k == 1:
		print(math.ceil((n - 2) / 2))
		return
	amount = 0
	for i in range(1, n - 1):
		if a[i] > a[i - 1] + a[i + 1]:
			amount += 1
	print(amount)
	pass
t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	task(n, k, a)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if k == 1:
		if n % 2 == 0:
			n = n - 2
			print(n // 2)
		else:
			print(n // 2)
	else:
		count = 0
		for i in range(1, len(l) - 1):
			if l[i] > l[i - 1] + l[i + 1]:
				count = count + 1
		print(count)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	c = 0
	for j in range(1, n - 1):
		if a[j] > a[j - 1] + a[j + 1]:
			c += 1
	if k != 1:
		print(c)
	elif n % 2 == 0:
		print(int(n / 2) - 1)
	else:
		print(int(n // 2))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k == 1:
		print((n - 1) // 2)
	else:
		r = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				r += 1
		print(r)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k == 1:
		ans = 0
		for i in range(1, n - 1, 2):
			ans += 1
		print(ans)
		continue
	ans = 0
	for i in range(1, n - 1):
		if a[i] > a[i - 1] + a[i + 1]:
			ans += 1
	print(ans)


import sys
import collections
from math import ceil, gcd, sqrt, log
import bisect
INF = float('inf')
mod = 1000000007

def solve():
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	if k == 1:
		if n % 2 == 0:
			print((n - 1) // 2)
		else:
			print(n // 2)
		return
	count = 0
	for i in range(1, n - 1):
		if A[i] > A[i + 1] + A[i - 1]:
			count += 1
	print(count)
t = int(input())
while t != 0:
	solve()
	t -= 1


from collections import *
from functools import lru_cache

def readline():
	s = input()
	return s.split(' ')

def readlineint():
	return [*map(int, readline())]

def readint():
	s = input()
	return int(s)

def testcase():
	[N, k] = readlineint()
	t = readlineint()
	res = 0
	if k == 1:
		print((N - 1) // 2)
		return
	for i in range(1, N - 1):
		if t[i - 1] + t[i + 1] < t[i]:
			res += 1
	print(res)
N = readint()
for _ in range(N):
	testcase()


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	array = [int(x) for x in input().split()]
	count = 0
	if k != 1:
		for i in range(1, n - 1):
			if array[i] > array[i - 1] + array[i + 1]:
				count += 1
		print(count)
	else:
		print((n - 1) // 2)


def solve(S, n, k):
	if k == 1:
		return (n - 1) // 2
	count = 0
	for i in range(1, n - 1):
		if S[i] > S[i - 1] + S[i + 1]:
			count += 1
	return count
for case in range(int(input())):
	(n, k) = map(int, input().split())
	S = list(map(int, input().split()))
	print(solve(S, n, k))


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	c = 0
	for i in range(1, n - 1):
		if arr[i] > arr[i - 1] + arr[i + 1]:
			c += 1
	if k == 1:
		print((n - 2) // 2 + (n - 2) % 2)
	else:
		print(c)


class RisingSand:

	def findTooTall(self, n, k, a):
		if k == 1:
			if n % 2:
				print(n // 2)
				return
			else:
				print((n - 1) // 2)
				return
		count = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				count += 1
		print(count)
		return
T = int(input())
while T:
	T -= 1
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	RisingSand().findTooTall(n, k, a)


def get_tall_piles(a, k):
	n = len(a)
	if k == 1:
		return (n - 1) // 2
	count = 0
	for i in range(1, n - 1):
		if a[i] > a[i - 1] + a[i + 1]:
			count += 1
	return count
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	print(get_tall_piles(a, k))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	mass = list(map(int, input().split()))
	if k == 1:
		print((n - 1) // 2)
		continue
	e = 0
	for i in range(1, n - 1):
		if mass[i] > mass[i - 1] + mass[i + 1]:
			e += 1
	print(e)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	if b == 1:
		print((a - 1) // 2)
	else:
		d = 0
		for j in range(1, a - 1):
			if c[j] > c[j - 1] + c[j + 1]:
				d += 1
		print(d)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = list(map(int, input().split()))
	if y > 1:
		a = 0
		for i in range(x - 2):
			if z[i] - z[i + 1] < -z[i + 2]:
				a += 1
		print(a)
	else:
		print((x - 1) // 2)


import math
from collections import Counter

def fun(a, n):
	c = 0
	if n == 1:
		for i in range(1, len(a) - 1):
			if i % 2 != 0:
				c += 1
		return c
	for i in range(1, len(a) - 1):
		if a[i] > a[i + 1] + a[i - 1]:
			c += 1
	return c
n = int(input())
for _ in range(n):
	l = input().split()
	x = input().split()
	x = list(map(int, x))
	print(fun(x, int(l[-1])))


def find_max(seq):
	cnt = 0
	for i in range(1, len(seq) - 1):
		if seq[i] > seq[i - 1] + seq[i + 1]:
			cnt += 1
	return cnt
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	seq = list(map(int, input().split()))
	mx = (n - 1) // 2
	cur_mx = find_max(seq)
	if k == 1:
		print(mx)
	else:
		print(cur_mx)


testcases = int(input())
for i in range(testcases):
	(n, k) = map(int, input().split())
	li = list(map(int, input().split()))
	count = 0
	if k != 1:
		for j in range(1, n - 1):
			if li[j] > li[j - 1] + li[j + 1]:
				count += 1
		print(count)
	else:
		print((n - 1) // 2)


for f in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k != 1:
		brojac = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				brojac += 1
				i += 1
		print(brojac)
	else:
		print((n - 1) // 2)


t = int(input())
for _ in range(t):
	(n, k) = (int(i) for i in input().split())
	if k == 1:
		input()
		print((n - 1) // 2)
		continue
	a = [int(i) for i in input().split()]
	res = sum((1 for i in range(1, n - 1) if a[i] > a[i - 1] + a[i + 1]))
	print(res)


for _ in range(int(input())):
	a = [int(_) for _ in input().split()]
	b = [int(_) for _ in input().split()]
	if a[1] == 1:
		print((a[0] - 1) // 2)
	else:
		c = 0
		for i in range(1, a[0] - 1):
			if b[i] > b[i - 1] + b[i + 1]:
				c += 1
		print(c)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	list1 = list(map(int, input().split()))
	count = 0
	if k == 1:
		count = math.ceil((n - 2) / 2)
		print(count)
	else:
		for i in range(1, n - 1):
			if list1[i] > list1[i - 1] + list1[i + 1]:
				count += 1
		print(count)


import sys

def read(type):
	return type(sys.stdin.readline().strip())
for _ in range(read(int)):
	(n, k) = map(int, sys.stdin.readline().split())
	l = list(map(int, sys.stdin.readline().split()))
	ans = 0
	if k == 1:
		print(int((n - 1) / 2))
	else:
		for i in range(1, n - 1):
			if l[i] > l[i - 1] + l[i + 1]:
				ans += 1
		print(ans)


test = int(input())
while test:
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	c = 0
	if k == 1:
		print((n - 1) // 2)
	else:
		for i in range(1, len(a) - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				c += 1
		print(c)
	test -= 1


t = int(input())
for elem in range(t):
	(n, k) = map(int, input().split())
	a = [int(el) for el in input().split()]
	c = 0
	for i in range(1, n - 1):
		if a[i] > a[i - 1] + a[i + 1]:
			c += 1
	if k == 1:
		print((n - 2 + 1) // 2)
	else:
		print(c)


T = int(input())
for t in range(T):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if k == 1:
		if (n - 2) % 2 == 0:
			print((n - 2) // 2)
		else:
			print((n - 2) // 2 + 1)
	else:
		c = 0
		for i in range(1, n - 1):
			if l[i] > l[i - 1] + l[i + 1]:
				c += 1
		print(c)


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k == 1:
		print(math.ceil((n - 2) / 2))
	else:
		c = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				c += 1
		print(c)


for _ in range(int(input())):
	(m, n) = map(int, input().split())
	c = 0
	array = list(map(int, input().split()))
	if n == 1:
		if m % 2 != 0:
			print(m // 2)
		else:
			print((m - 1) // 2)
	else:
		for i in range(1, len(array) - 1):
			if array[i] > array[i - 1] + array[i + 1]:
				c += 1
				i += 2
		print(c)


numTestCases = int(input())
for i in range(0, numTestCases):
	inputsNK = input().split(' ')
	sandPiles = list(map(int, input().split(' ')))
	numTooTall = 0
	if int(inputsNK[1]) != 1:
		for j in range(1, len(sandPiles) - 1):
			if sandPiles[j] > sandPiles[j + 1] + sandPiles[j - 1]:
				numTooTall += 1
	else:
		for k in range(2, len(sandPiles), 2):
			numTooTall += 1
	print(numTooTall)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	sand = list(map(int, input().split()))
	if k == 1:
		print((n - 1) // 2)
		continue
	count = 0
	for i in range(1, n - 1):
		if sand[i] > sand[i - 1] + sand[i + 1]:
			count += 1
	print(count)


ans = []
for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	x = 0
	if k > 1:
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				x += 1
	else:
		x = (n - 1) // 2
	ans.append(x)
for i in ans:
	print(i)


for qwerty in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if k == 1:
		print(n // 2 - 1 + n % 2)
	else:
		ans = 0
		for i in range(1, n - 1):
			if l[i - 1] + l[i + 1] < l[i]:
				ans += 1
		print(ans)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	if k == 1:
		print((n - 1) // 2)
	else:
		res = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				res += 1
		print(res)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	lst = list(map(int, input().split()))
	c = 0
	for j in range(1, n - 1):
		if lst[j] > lst[j - 1] + lst[j + 1]:
			c += 1
	if k == 1:
		n -= 2
		if n % 2 == 0:
			ele = n // 2
		else:
			ele = n // 2 + 1
		if c < ele:
			c = ele
	print(c)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k != 1:
		s = 0
		for x in range(1, n - 1):
			if a[x] > a[x - 1] + a[x + 1]:
				s += 1
		print(s)
	else:
		print(n // 2 + n % 2 - 1)


import sys
input = sys.stdin.readline
t = int(input())
for q in range(t):
	(n, delta) = map(int, input().split())
	arr = list(map(int, input().split()))
	c = 0
	for i in range(1, len(arr) - 1):
		if arr[i] > arr[i - 1] + arr[i + 1]:
			c += 1
	if delta == 1:
		print(max((len(arr) - 2) // 2, len(arr) - 2 - (len(arr) - 2) // 2))
	else:
		print(c)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().strip().split()))
	c = 0
	if k == 1:
		print((n - 1) // 2)
		continue
	for i in range(1, n - 1):
		if l[i] > l[i - 1] + l[i + 1]:
			c += 1
	print(c)


t = int(input())
while t > 0:
	t = t - 1
	(n, k) = [int(i) for i in input().split()]
	l = [int(i) for i in input().split()]
	if k == 1:
		print((n - 1) // 2)
	else:
		c = 0
		for i in range(1, n - 1):
			if l[i] > l[i - 1] + l[i + 1]:
				c = c + 1
		print(c)


for _ in range(int(input().strip())):
	(n, k) = [int(x) for x in input().split(' ')]
	arr = [int(x) for x in input().split(' ')]
	if k == 1:
		print((n - 1) // 2)
	else:
		ans = 0
		for i in range(1, n - 1):
			if arr[i] > arr[i - 1] + arr[i + 1]:
				ans += 1
		print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	if n == k:
		ans = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				ans += 1
		print(ans)
	elif k == 1:
		ans = 0
		for i in range(1, n - 1):
			if i % 2 == 1:
				ans += 1
		print(ans)
	else:
		ans = 0
		for i in range(1, n - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				ans += 1
		print(ans)


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	g = 0
	if k == 1:
		g = int(math.ceil(len(a) / 2) - 1)
	else:
		for i in range(1, len(a) - 1):
			if a[i] > a[i - 1] + a[i + 1]:
				g = g + 1
	print(g)


tc = int(input())
while tc > 0:
	N = [int(i) for i in input().split(' ')]
	n = N[0]
	k = N[1]
	A = [int(i) for i in input().split(' ')]
	ans = 0
	if k == 1:
		if n % 2 == 0:
			ans = (n - 2) // 2
		else:
			ans = (n - 2) // 2 + 1
	else:
		for i in range(1, n - 1):
			if A[i] > A[i - 1] + A[i + 1]:
				ans += 1
	print(ans)
	tc = tc - 1