Suppose $a_1, a_2, \dots, a_n$ is a sorted integer sequence of length $n$ such that $a_1 \leq a_2 \leq \dots \leq a_n$.

For every $1 \leq i \leq n$, the prefix sum $s_i$ of the first $i$ terms $a_1, a_2, \dots, a_i$ is defined by $$ s_i = \sum_{k=1}^i a_k = a_1 + a_2 + \dots + a_i. $$

Now you are given the last $k$ terms of the prefix sums, which are $s_{n-k+1}, \dots, s_{n-1}, s_{n}$. Your task is to determine whether this is possible.

Formally, given $k$ integers $s_{n-k+1}, \dots, s_{n-1}, s_{n}$, the task is to check whether there is a sequence $a_1, a_2, \dots, a_n$ such that

$a_1 \leq a_2 \leq \dots \leq a_n$, and

$s_i = a_1 + a_2 + \dots + a_i$ for all $n-k+1 \leq i \leq n$.


-----Input-----

Each test contains multiple test cases. The first line contains an integer $t$ ($1 \leq t \leq 10^5$) — the number of test cases. The following lines contain the description of each test case.

The first line of each test case contains two integers $n$ ($1 \leq n \leq 10^5$) and $k$ ($1 \leq k \leq n$), indicating the length of the sequence $a$ and the number of terms of prefix sums, respectively.

The second line of each test case contains $k$ integers $s_{n-k+1}, \dots, s_{n-1}, s_{n}$ ($-10^9 \leq s_i \leq 10^9$ for every $n-k+1 \leq i \leq n$).

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


-----Output-----

For each test case, output "YES" (without quotes) if it is possible and "NO" (without quotes) otherwise.

You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).


-----Examples-----

Input
4
5 5
1 2 3 4 5
7 4
-6 -5 -3 0
3 3
2 3 4
3 2
3 4
Output
Yes
Yes
No
No


-----Note-----

In the first test case, we have the only sequence $a = [1, 1, 1, 1, 1]$.

In the second test case, we can choose, for example, $a = [-3, -2, -1, 0, 1, 2, 3]$.

In the third test case, the prefix sums define the only sequence $a = [2, 1, 1]$, but it is not sorted.

In the fourth test case, it can be shown that there is no sequence with the given prefix sums.

Source: codeforces | Difficulty: EASY
Tags: Greedy algorithms

Sorting

Mathematics

Constructive algorithms


Solutions:
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = list(map(int, input().split()))
	if k == 1:
		print('Yes')
	elif s[1] - s[0] < s[0] / (n - k + 1):
		print('No')
	else:
		for i in range(1, k - 1):
			if s[i] - s[i - 1] > s[i + 1] - s[i]:
				print('No')
				break
		else:
			print('Yes')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	r = True
	(n, k) = map(int, input().split())
	sums = list(map(int, input().split()))
	if k == 1:
		print('Yes')
		continue
	ss = []
	for x in range(k - 1):
		ss.append(sums[x + 1] - sums[x])
	for x in range(len(ss) - 1):
		if ss[x] > ss[x + 1]:
			r = False
			break
	mi = ss[0]
	if r:
		if sums[0] <= (n - k + 1) * ss[0]:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	a = list(map(int, sys.stdin.readline().split()))
	b = []
	f = 1
	if k == 1:
		print('Yes')
		continue
	for i in range(1, k):
		b.append(a[i] - a[i - 1])
		if i > 1 and b[-2] > b[-1]:
			f = 0
			break
	if b[0] < a[0] / (n - k + 1):
		f = 0
	if f:
		print('Yes')
	else:
		print('No')


import sys

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

def read_iarray():
	return [int(i) for i in sys.stdin.readline().strip().split()]

def solve(n, k, tots):
	mi = 1 << 31
	for i in range(k - 1):
		if tots[k - i - 1] - tots[k - i - 2] > mi:
			return False
		mi = tots[k - i - 1] - tots[k - i - 2]
	return (n - k + 1) * mi >= tots[0]
t = read_int()
for _ in range(t):
	(n, k) = read_iarray()
	tots = read_iarray()
	print('Yes' if solve(n, k, tots) else 'No')


import sys
readline = sys.stdin.readline
INF = 1 << 60
T = int(readline())
for _ in range(T):
	(N, K) = map(int, readline().split())
	S = list(map(int, readline().split()))[::-1]
	A = INF
	for i in range(1, K):
		tmp = S[i - 1] - S[i]
		if A >= tmp:
			A = tmp
		else:
			print('No')
			break
	else:
		s = S[-1]
		num = N - (K - 1)
		tmp = (s + num - 1) // num
		if tmp <= A:
			print('Yes')
		else:
			print('No')


import sys
input = sys.stdin.readline

def is_sorted(l):
	return all((a <= b for (a, b) in zip(l, l[1:])))
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	lst = list(map(int, input().split()))
	ans = [-float('inf')] * n
	i = n - 1
	cond = False
	prev = float('inf')
	x = k - 1
	while x > 0:
		ans[i] = lst[x] - lst[x - 1]
		prev = ans[i]
		i -= 1
		x -= 1
	if i == 0:
		ans[0] = lst[0]
	if prev == float('inf'):
		print('Yes')
		continue
	if is_sorted(ans[i:]) == False:
		print('No')
		continue
	if prev * (i + 1) < lst[x]:
		print('No')
	else:
		print('Yes')


import sys
input = sys.stdin.readline
import math

def solve():
	(n, k) = map(int, input().split())
	first = -1000000000.0
	arr = list(map(int, input().split()))
	first = int(math.ceil(arr[0] / (n - k + 1)))
	d = [first]
	d += [arr[i + 1] - arr[i] for i in range(k - 1)]
	for i in range(k - 1):
		if d[i] > d[i + 1]:
			return 'No'
	return 'Yes'
for _ in range(int(input())):
	print(solve())


def get_numbers_list(string_list):
	string_split_list = string_list.split()
	number_list = []
	for element in string_split_list:
		number_list.append(int(element))
	return number_list

def check(number_list, n, k):
	last_number = number_list[k - 1] - number_list[k - 2]
	for i in range(k - 2, 0, -1):
		val = number_list[i] - number_list[i - 1]
		if val > last_number:
			print('No')
			return
		else:
			last_number = val
	min_val = number_list[0] / (n - k + 1)
	if min_val > last_number:
		print('No')
	else:
		print('Yes')

def main():
	t = int(input())
	for i in range(t):
		pair = input().split()
		n = int(pair[0])
		k = int(pair[1])
		string_list = input()
		if k == 1:
			print('Yes')
			continue
		number_list = get_numbers_list(string_list)
		check(number_list, n, k)
main()


t = int(input())
for z in range(t):
	l0 = input().split()
	(n, k) = (int(l0[0]), int(l0[1]))
	l = input().split()
	l1 = []
	if k == 1:
		print('Yes')
	else:
		for i in range(k - 1):
			l1.append(int(l[i + 1]) - int(l[i]))
		if sorted(l1) == l1:
			if int(l[0]) / (n - k + 1) > l1[0]:
				print('No')
			else:
				print('Yes')
		else:
			print('No')


def foo(n, k, s):
	if n == 1 or k == 1:
		return True
	s = s[::-1]
	pre = s[0] - s[1]
	for i in range(2, k):
		cur = s[i - 1] - s[i]
		if cur > pre:
			return False
		pre = cur
	remain = pre * (n - k + 1)
	return s[-1] <= remain
t = int(input())
for _ in range(t):
	(n, k) = [int(i) for i in input().split()]
	s = [int(i) for i in input().split()]
	print('Yes' if foo(n, k, s) else 'No')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = list(map(int, input().split()))
	if k == 1:
		print('Yes')
		continue
	l = s[0]
	(f, pre) = (0, s[1] - s[0])
	if pre * (n - k + 1) < s[0]:
		print('No')
		continue
	for i in range(len(s) - 1):
		val = s[i + 1] - s[i]
		if val < pre:
			f = -1
			break
		pre = val
	if f == -1:
		print('No')
	else:
		print('Yes')


t = int(input())
for _ in range(t):
	nk = [int(ii) for ii in input().split()]
	(n, k) = (nk[0], nk[1])
	s = [int(ii) for ii in input().split()]
	if k == 1:
		print('Yes')
		continue
	b = []
	bb = []
	for i in range(1, k):
		b.append(s[i] - s[i - 1])
		bb.append(s[i] - s[i - 1])
	bb.sort()
	if b != bb:
		print('No')
		continue
	if (n - k + 1) * b[0] < s[0]:
		print('No')
	else:
		print('Yes')


t = int(input())
for r in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if n == 1 or k == 1:
		print('Yes')
	else:
		d = [l[0]]
		for i in range(1, k):
			d.append(l[i] - l[i - 1])
		if d[1:] == sorted(d[1:]) and d[0] <= d[1] * (n - k + 1):
			print('Yes')
		else:
			print('No')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = list(map(int, input().split()))
	if k == 1:
		print('Yes')
	elif s[1] - s[0] < s[0] / (n - k + 1):
		print('No')
	else:
		for i in range(1, k - 1):
			if s[i] - s[i - 1] > s[i + 1] - s[i]:
				print('No')
				break
		else:
			print('Yes')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	s = [int(x) for x in input().split()]
	if k == 1:
		print('Yes')
		continue
	if (n - k + 1) * (s[1] - s[0]) < s[0]:
		print('No')
		continue
	arr = [s[i + 1] - s[i] for i in range(k - 1)]
	for i in range(k - 2):
		if arr[i] > arr[i + 1]:
			print('No')
			break
	else:
		print('Yes')


import math
T = int(input(''))
for i in range(T):
	str1 = input()
	l1 = [int(c) for c in str1.split()]
	str1 = input()
	l2 = [int(c) for c in str1.split()]
	n = l1[0]
	k = l1[1]
	flag = 0
	if k == 1:
		print('Yes')
	else:
		if k != 2:
			j = len(l2) - 1
			while j > 2 and l2[j] - l2[j - 1] >= l2[j - 1] - l2[j - 2]:
				j -= 1
			if l2[j] - l2[j - 1] < l2[j - 1] - l2[j - 2]:
				flag = 1
				print('No')
				continue
		if flag != 1:
			latestNum = l2[1] - l2[0]
			if (n - k + 1) * latestNum < l2[0]:
				print('No')
			else:
				print('Yes')


def getint():
	return [int(i) for i in input().split()]

def get():
	return int(input())

def S():
	for test in range(int(input())):
		solve()

def solve():
	(n, k) = getint()
	p = getint()
	if k == 1:
		print('Yes')
		return
	if k > n:
		print('No')
		return
	if n == k:
		a = p.copy()
		for i in range(1, n):
			a[i] = p[i] - p[i - 1]
		if sorted(a) == a:
			print('Yes')
		else:
			print('No')
	else:
		a = p.copy()
		for i in range(k - 1, 0, -1):
			a[i] = p[i] - p[i - 1]
		if sorted(a[1:]) == a[1:]:
			if (n - k + 1) * a[1] >= p[0]:
				print('Yes')
			else:
				print('No')
		else:
			print('No')
S()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = list(map(int, input().split()))
	if k == 1:
		print('Yes')
		continue
	a = s[1] - s[0]
	c = False
	for i in range(k - 2):
		if s[i + 2] - s[i + 1] < s[i + 1] - s[i]:
			print('No')
			c = True
			break
	if c:
		continue
	print(['Yes', 'No'][s[0] > a * (n - k + 1)])


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	arr = list(map(int, input().strip().split()))[:k]
	l = arr[0]
	if n == 1 or k == 1:
		print('Yes')
	else:
		v = arr[-1]
		arr.reverse()
		brr = [0 for i in range(n)]
		for i in range(k - 1):
			brr[n - i - 1] = arr[i] - arr[i + 1]
		r = brr[n - k + 1]
		for i in range(1, n - k + 1, +1):
			brr[i] = r
		p = 0
		for i in range(1, n - k + 1, +1):
			p = p + brr[i]
		res = l - p
		brr[0] = res
		flag = 1
		for i in range(0, len(brr) - 1, +1):
			if brr[i] > brr[i + 1]:
				flag = 0
				break
		if flag == 1:
			print('Yes')
		else:
			print('No')
	t = t - 1


from collections import defaultdict
for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if k == 1:
		print('Yes')
		continue
	lans = []
	l = [0] + l
	for j in range(k):
		lans.append(l[j + 1] - l[j])
	if lans[1:] != sorted(lans[1:]):
		print('No')
	else:
		x = n - k
		if lans[0] > (x + 1) * lans[1]:
			print('No')
		else:
			print('Yes')


T = int(input())
for _ in range(T):
	(n, k) = list(map(int, input().split()))
	s = list(map(int, input().split()))
	c = False
	if k < 2:
		print('Yes')
		continue
	if k >= 2:
		kth = s[1] - s[0]
		max_sum = (n - k + 1) * kth
		if s[0] > max_sum:
			print('No')
			continue
	for i in range(2, len(s)):
		if s[i] - s[i - 1] < s[i - 1] - s[i - 2]:
			print('No')
			c = True
			break
	if c == False:
		print('Yes')


for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	if 'fvrfrref34r34r4' == 34366564455:
		print('Tanmay')
	a = [int(x) for x in input().split()]
	na = []
	if k == 1:
		print('Yes')
		continue
	for i in range(k - 1):
		na.append(a[i + 1] - a[i])
	if na != sorted(na):
		print('No')
		continue
	if a[0] <= (n - k + 1) * na[0]:
		print('Yes')
		continue
	print('No')


import math
for i in range(int(input())):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	if len(l) == 1:
		print('Yes')
		continue
	ln = n - m + 1
	last = math.ceil(l[0] / ln)
	if last + l[0] > l[1]:
		print('No')
		continue
	b = True
	for i in range(1, m):
		if l[i] - l[i - 1] < last:
			print('No')
			b = False
			break
		else:
			last = l[i] - l[i - 1]
	if b:
		print('Yes')


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

def li():
	return list(mi())

def si():
	return str(input())

def ni():
	return int(input())
for T in range(int(input())):
	(n, k) = mi()
	a = li()
	if n == 1 or k == 1:
		print('Yes')
		continue
	b = []
	flag = True
	for i in range(1, len(a)):
		b.append(a[i] - a[i - 1])
	for i in range(1, len(b)):
		if b[i] < b[i - 1]:
			flag = False
	if not flag:
		print('No')
		continue
	if a[0] <= b[0] * (n - k + 1):
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	xs = input()
	xs = [int(x) for x in xs.split()]
	an = xs[k - 1] - xs[k - 2]
	flag = True
	for j in range(k - 2, 0, -1):
		temp = xs[j] - xs[j - 1]
		if temp > an:
			flag = False
			break
		else:
			an = temp
	if k == 1:
		print('Yes')
	elif flag:
		length = n - k + 1
		highest = xs[0] // length + (xs[0] % length != 0)
		if highest <= an:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	a = [l[0] / (n - k + 1)]
	ans = 'Yes'
	for j in range(1, k):
		a.append(l[j] - l[j - 1])
		if a[-1] < a[-2]:
			ans = 'No'
			break
	print(ans)


t = int(input())
for ele in range(t):
	(n, k) = [int(x) for x in input().split()]
	s = [int(x) for x in input().split()]
	arr = [0]
	arr[0] = s[0] / (n - k + 1)
	ljawab = 'Yes'
	for i in range(len(s) - 1):
		arr.append(s[i + 1] - s[i])
		if arr[-1] < arr[-2]:
			ljawab = 'No'
			break
	print(ljawab)


tasks = int(input())
for t in range(tasks):
	(n, k) = list(map(int, input().split()))
	s = list(map(int, input().split()))
	if k == 1:
		print('Yes')
	else:
		last = s[-1] - s[-2]
		s.pop()
		result = 'Yes'
		while len(s) > 1:
			prelast = s[-1] - s[-2]
			s.pop()
			if prelast > last:
				result = 'No'
				break
			last = prelast
		else:
			if s[0] > last * (n - k + 1):
				result = 'No'
		print(result)


def exe():
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l2 = [l[0]]
	if k == 1:
		print('Yes')
		return
	for i in range(1, k):
		l2.append(l[i] - l[i - 1])
	for i in range(2, k):
		if l2[i] < l2[i - 1]:
			print('No')
			return
	if (n - k + 1) * l2[1] >= l2[0]:
		print('Yes')
	else:
		print('No')
	return
for i in range(int(input())):
	exe()


from collections import Counter, defaultdict
from functools import lru_cache
MOD = 10 ** 9 + 7
I = lambda : [int(x) for x in input().split()]
(E, P) = (enumerate, print)
PRINT_ARR = lambda nums: print(' '.join((str(num) for num in nums)))

def is_increasing(nums):
	for (a, b) in zip(nums, nums[1:]):
		if b < a:
			return False
	return True

def solve(N, S, K):
	if len(S) < 2:
		return True
	diffs = [b - a for (a, b) in zip(S, S[1:])]
	if not is_increasing(diffs):
		return False
	if N - K == 0:
		a = S[0]
		return a <= diffs[0]
	else:
		return (N - K + 1) * diffs[0] >= S[0]
num_testcases = int(input())
for _ in range(num_testcases):
	(N, K) = I()
	S = I()
	if solve(N, S, K):
		print('Yes')
	else:
		print('No')


t = int(input())
for q in range(t):
	(n, k) = map(int, input().split())
	s = list(map(int, input().split()))
	f = True
	f2 = True
	if k < 3:
		f2 = False
	r = 0
	if s[0] % (n - k + 1) == 0:
		r = 1
	if f2:
		if s[0] // (n - k + 1) + 1 - r > s[1] - s[0]:
			f = False
		for i in range(k - 2):
			if s[i + 1] - s[i] > s[i + 2] - s[i + 1]:
				f = False
	elif k == 2:
		if s[0] // (n - k + 1) + 1 - r > s[1] - s[0]:
			f = False
	if f:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = list(map(int, input().split()))
	a = []
	flag = 1
	for i in range(k - 1, 0, -1):
		x = s[i] - s[i - 1]
		if i != k - 1:
			if x > a[-1]:
				flag = 0
				break
		a.append(x)
	if k > 1 and a[-1] * (n - k + 1) < s[0]:
		flag = 0
	if flag:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().strip().split()))
	presum = list(map(int, input().strip().split()))
	if n == 1 or k == 1:
		print('Yes')
	else:
		flag = 0
		max = -10 ** 10
		for i in range(1, k):
			a = presum[i] - presum[i - 1]
			if a >= max:
				max = a
			else:
				flag = 1
				break
		if flag == 1:
			print('No')
		else:
			first = presum[1] - presum[0]
			if first * (n - k + 1) >= presum[0]:
				print('Yes')
			else:
				print('No')


t = int(input())
for i in range(t):
	y = []
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	y = input().split()
	for i in range(len(y)):
		y[i] = int(y[i])
	a = [y[0] / (n - k + 1)]
	r = 'Yes'
	for j in range(1, k):
		a.append(y[j] - y[j - 1])
		if a[-1] < a[-2]:
			r = 'No'
			break
	print(r)


def solve(n, k, Y):
	B = [Y[i + 1] - Y[i] for i in range(len(Y) - 1)]
	if B[0] * (n - k + 1) < Y[0]:
		return False
	prev = Y[0] / (n - k + 1)
	for i in B:
		if i < prev:
			return False
		prev = i
	return True
N = int(input())
for _ in range(N):
	X = [int(x) for x in input().split(' ')]
	Y = [int(x) for x in input().split(' ')]
	if X[0] == 1 and X[1] == 1:
		print('Yes')
		continue
	if len(Y) == 1:
		print('Yes')
		continue
	if solve(X[0], X[1], Y):
		print('Yes')
	else:
		print('No')


import math
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	s = list(map(int, input().split()))
	d = []
	c = 0
	for i in range(k):
		if i >= 1:
			tmp = s[i] - s[i - 1]
			d.append(tmp)
			if s[i - 1] > (n - k + i) * tmp:
				c = 1
				break
	if c == 0:
		for i in range(len(d)):
			if i >= 1:
				if d[i] < d[i - 1]:
					c = 1
					break
		if c == 1:
			print('No')
		else:
			print('Yes')
	else:
		print('No')


import math
t = int(input())
for t1 in range(t):
	tmp = input().split()
	n = int(tmp[0])
	k = int(tmp[1])
	s = [int(x) for x in input().split()]
	a = [s[0] / (n - k + 1)]
	ans = 'Yes'
	for i in range(1, k):
		a.append(s[i] - s[i - 1])
		if a[-1] < a[-2]:
			ans = 'No'
			break
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	before = (arr[0] + n - k) // (n - k + 1)
	for x in range(len(arr) - 1):
		if before <= arr[x + 1] - arr[x]:
			pass
		else:
			print('No')
			break
		before = arr[x + 1] - arr[x]
	else:
		print('Yes')


def inp_arr():
	return list(map(int, input().strip().split(' ')))

def inp_int():
	return int(input())

def inp_str():
	return input()

def solve():
	(n, k) = inp_arr()
	a = inp_arr()
	last = 10000000000.0
	minn = 10000000000.0
	for i in range(k - 1, 0, -1):
		temp = a[i] - a[i - 1]
		if last != 10000000000.0:
			if temp > last:
				print('No')
				return
		last = temp
		minn = min(last, minn)
	remaining = n - k + 1
	temp = a[0] / remaining
	if temp > minn:
		print('No')
		return
	print('Yes')
	return
tt = inp_int()
for t in range(tt):
	solve()


test = int(input())
for t in range(test):
	nk = list(map(int, input().split()))
	n = nk[0]
	k = nk[1]
	s = list(map(int, input().split()))
	a = list()
	b = list()
	for i in range(1, k):
		a.append(s[i] - s[i - 1])
		b.append(s[i] - s[i - 1])
	b.sort()
	if a != b:
		print('No')
	elif k == 1:
		print('Yes')
	elif s[0] / (n - k + 1) > a[0]:
		print('No')
	else:
		print('Yes')


def main():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	prev = float('inf')
	i = k - 1
	while i > 0:
		if arr[i] - arr[i - 1] > prev:
			return 'No'
		prev = arr[i] - arr[i - 1]
		i -= 1
	if n == k:
		if arr[0] > prev:
			return 'No'
	rem = n - k + 1
	if rem * prev < arr[0]:
		return 'No'
	return 'Yes'
for _ in range(int(input())):
	print(main())


from math import ceil
t = int(input())

def check():
	(n, k) = [int(x) for x in input().split(' ')]
	s = [int(x) for x in input().split(' ')]
	min_pos = ceil(s[0] / (n - k + 1))
	for idx in range(1, len(s)):
		if s[idx] < s[idx - 1] + min_pos:
			return 'No'
		min_pos = s[idx] - s[idx - 1]
	return 'Yes'
for _ in range(t):
	print(check())


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = [0] * k
	b[0] = a[0]
	flag = 0
	for i in range(len(a) - 1, 0, -1):
		b[i] = a[i] - a[i - 1]
		if i < len(a) - 1 and b[i + 1] < b[i]:
			print('No')
			flag = 1
			break
	if flag:
		continue
	if k == 1:
		print('Yes')
		continue
	else:
		sum_first = b[0]
		num_first = n - k + 1
		last_num = b[1]
		sum_assume = num_first * last_num
		if sum_assume < sum_first:
			print('No')
			continue
		else:
			print('Yes')
			continue


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	lst = list(map(int, input().split()))
	arr = []
	for i in range(k - 1):
		arr.append(lst[i + 1] - lst[i])
	temp = arr.copy()
	temp.sort()
	if k == 1:
		print('Yes')
		continue
	if arr == temp:
		pass
	else:
		print('No')
		continue
	if n != k:
		pass
	else:
		mini = temp[0]
		for i in temp:
			if i < mini:
				mini = i
		if mini < lst[0]:
			print('No')
			continue
		else:
			print('Yes')
			continue
	mini = temp[0]
	for i in temp:
		if i < mini:
			mini = i
	if mini * (n - k + 1) < lst[0]:
		print('No')
		continue
	else:
		print('Yes')
		continue