Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well.

Chef decided to go on a diet during the following $N$ days (numbered $1$ through $N$). Part of the diet plan is to eat $K$ grams of protein during each day. For each valid $i$, Chef wants to buy $A_{i}$ grams of protein in the morning of the $i$-th day and then eat $K$ grams of protein as part of his dinner. If he has any protein remaining, he can store it and use it in later dinners. Initially, Chef is storing $0$ grams of protein.

Determine whether Chef will have enough protein all the time during his diet. In case he will not have enough, find the first day on which Chef will be unable to eat $K$ grams of protein.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains two space-separated integers $N$ and $K$. 
The second line contains $N$ space-separated integers $A_{1}, A_{2}, \ldots, A_{N}$.

------  Output ------
For each test case:
If Chef will have enough protein during his diet, print a single line containing the string "YES".
Otherwise, print a single line containing the string "NO", followed by a space and one integer — the first day when Chef will be unable to eat $K$ grams of protein.

------  Constraints ------
$1 ≤ T ≤ 200$
$1 ≤ N ≤ 100$
$1 ≤ K ≤ 10^{6}$
$1 ≤ A_{i} ≤ 10^{6}$ for each valid $i$

----- Sample Input 1 ------ 
3

4 5

7 3 6 5

3 4

3 10 10

3 4

8 1 1
----- Sample Output 1 ------ 
YES

NO 1

NO 3
----- explanation 1 ------ 
Example case 1: On the first day, Chef buys $7$ grams, eats $5$ and stores $2$ grams for later. On the second day, he buys $3$ grams, so he has $5$ grams, which is just enough for the dinner on this day. On the third day, he buys $6$ grams, eats $5$ and stores $1$, and on the fourth day, he buys $5$ grams, so he has $6$ grams — enough for dinner. In the end, he had enough protein to eat during all four dinners.

Example case 2: Chef needs to eat $4$ grams of protein on the first day, but he only has $3$ grams, so he does not have a sufficient amount of protein already for the first dinner.

Source: codechef | Difficulty: EASY
Tags: Implementation


Solutions:
for joe_mama in range(int(input())):
	(n, k) = map(int, input().split())
	(i, v) = (0, 0)
	l = list(map(int, input().split()))
	while i < n and l[i] + v - k >= 0:
		v = v + l[i] - k
		i += 1
	if i == n:
		print('YES')
	else:
		print('NO ', i + 1)


s = int(input())
for i in range(s):
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	left = 0
	for j in range(a):
		left = c[j] - b + left
		if left < 0:
			print('NO', j + 1)
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	s = 0
	for i in range(0, n):
		if l[i] + s < k:
			print('NO', end=' ')
			print(i + 1)
			s = s + l[i] - k
			break
		else:
			s = s + l[i] - k
	if s >= 0:
		print('YES')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = [int(x) for x in input().split()]
	carry = 0
	flag = 0
	for i in range(a):
		if l[i] + carry >= b:
			carry += l[i] - b
			continue
		else:
			print('NO', i + 1, sep=' ')
			flag += 1
			break
	if flag == 0:
		print('YES')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	s = 0
	b = False
	for i in range(0, n):
		s = s + a[i]
		if s < k:
			b = True
			break
		s = s - k
	if b == True:
		print('NO', i + 1)
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	total_protein = 0
	day = -1
	for i in range(n):
		total_protein += a[i]
		if total_protein < k:
			day = i + 1
			break
		total_protein -= k
	if day == -1:
		print('YES')
	else:
		print('NO', day)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	x = 0
	for i in range(n):
		if l[i] < k:
			x = i + 1
			break
		elif l[i] > n and i < n - 1:
			l[i + 1] += l[i] - k
	if x == 0:
		print('YES')
	else:
		print(f'NO {x}')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	gm = 0
	for i in range(n):
		gm = gm + l[i]
		if gm < k:
			print('NO ', i + 1)
			break
		else:
			gm = gm - k
	else:
		print('YES')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	s = 0
	for i in range(n):
		s += a[i]
		if s < k:
			print(f'NO {i + 1}')
			break
		else:
			s -= k
	else:
		print('YES')


def findValue(q, eat, day):
	bien = 0
	flag = 0
	status = 'YES'
	for j in range(len(q)):
		bien = bien + q[j] - eat
		if bien >= 0:
			continue
		else:
			flag = j + 1
			status = 'NO'
			break
	if flag == 0:
		print(status)
	else:
		print(status, flag)
t = int(input())
for i in range(t):
	(day, eat) = map(int, input().split())
	q = list(map(int, input().split()))
	findValue(q, eat, day)


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	c = 0
	d = 0
	for j in range(n):
		c += a[j]
		if c < k * (j + 1):
			d = j + 1
			break
	if d == 0:
		print('YES')
	else:
		print('NO', d)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	(rem, ans) = (0, 0)
	for i in range(n):
		if arr[i] >= k:
			rem = rem + arr[i] - k
		elif arr[i] < k and arr[i] + rem >= k:
			rem = rem + arr[i] - k
		else:
			ans = i + 1
			break
	if ans > 0:
		print('NO', ans)
	else:
		print('YES')


T = int(input())
for i in range(T):
	(N, K) = map(int, input().split())
	A = input().split()
	store = 0
	i = 0
	while i < N:
		store = store + int(A[i])
		if store >= K:
			store -= K
			i += 1
			continue
		else:
			print('NO', i + 1)
			break
	if i == N:
		print('YES')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	lst = input().split()
	prot = 0
	i = 0
	while i < n:
		prot = prot + int(lst[i])
		if prot >= k:
			prot -= k
			i += 1
			continue
		else:
			print('NO', i + 1)
			break
	if i == n:
		print('YES')


T = int(input())
while T > 0:
	(N, K) = map(int, input().split(' '))
	A = []
	A.extend(input().split(' '))
	A = [int(x) for x in A]
	left = 0
	flag = 1
	for i in range(N):
		P = A[i] + left
		if P - K < 0:
			print('NO', i + 1)
			flag = 0
			break
		else:
			left += A[i] - K
	if flag:
		print('YES')
	T = T - 1


def cek_prot(n, k, a):
	prot = 0
	for y in range(n):
		prot += a[y]
		if prot < k:
			return 'NO ' + str(y + 1)
		prot -= k
	return 'YES'
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	print(cek_prot(n, k, a))


def fun(l, k):
	for i in range(len(l)):
		if l[i] < k:
			return f'NO {i + 1}'
		else:
			try:
				l[i + 1] += l[i] - k
			except:
				pass
	return 'YES'
for i in range(int(input())):
	(n, k) = map(int, input().split(' '))
	l = list(map(int, input().split(' ')))
	print(fun(l, k))


def can_have_enough_protein(N, K, A):
	remaining = 0
	for i in range(N):
		remaining += A[i]
		if remaining < K:
			return 'NO ' + str(i + 1)
		remaining -= K
	return 'YES'
T = int(input())
for _ in range(T):
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))
	print(can_have_enough_protein(N, K, A))


for _ in range(int(input())):
	(days, k) = map(int, input().split())
	m = list(map(int, input().split()))
	x = 0
	for i in range(days):
		x = x + m[i]
		x = x - k
		if x < 0:
			print('NO', i + 1)
			break
	if x >= 0:
		print('YES')


Test = int(input())
for cases in range(Test):
	(NumberofDays, ProteinIntake) = map(int, input().split())
	ProteinBought = list(map(int, input().split()))
	ProteinRemaining = 0
	for Protein in range(NumberofDays):
		ProteinRemaining = ProteinRemaining + ProteinBought[Protein]
		ProteinRemaining = ProteinRemaining - ProteinIntake
		if ProteinRemaining < 0:
			print('NO', Protein + 1)
			break
	if ProteinRemaining >= 0:
		print('YES')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	p = 0
	for i in range(n):
		p = p + a[i]
		p = p - k
		if p < 0:
			print('NO', i + 1)
			break
	if p >= 0:
		print('YES')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	store = 0
	for (i, x) in enumerate(l):
		store += x
		store -= k
		if store < 0:
			print('NO', i + 1)
			break
	else:
		print('YES')


n = int(input())
for i in range(n):
	(noDays, amtPro) = input().split(' ')
	(noDays, amtPro) = (int(noDays), int(amtPro))
	arr = [int(x) for x in input().split(' ')]
	remPro = 0
	for j in range(1, noDays + 1):
		remPro += arr[j - 1] - amtPro
		if remPro < 0:
			print('NO', j)
			break
	if remPro >= 0:
		print('YES')


def fun(n, k, l):
	for i in range(n):
		if l[i] < k:
			return 'NO ' + str(i + 1)
		elif i != n - 1:
			l[i + 1] = l[i + 1] + l[i] - k
	return 'YES'
for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	print(fun(n, k, l))


T = int(input())
for _ in range(T):
	(N, K) = list(map(int, input().split()))
	A = list(map(int, input().split()))
	bal = 0
	cnt = 1
	flag = True
	for i in A:
		bal += i
		if bal < K:
			print('NO', cnt)
			flag = False
			break
		else:
			bal -= K
			cnt += 1
	if flag == True:
		print('YES')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	rem = 0
	flag = 0
	for i in range(n):
		rem += a[i]
		if rem >= k:
			rem -= k
		else:
			print('NO ' + str(i + 1))
			flag = 1
			break
	if flag == 0:
		print('YES')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(i) for i in input().split()]
	o = 'YES'
	oi = 1
	d = 0
	for i in range(n):
		a[i] += d
		if a[i] < k:
			o = 'NO'
			oi += i
			break
		else:
			d = a[i] - k
	print('YES') if o == 'YES' else print('NO', oi)


t = int(input())
for i in range(t):
	(n, k) = [int(k) for k in input().split()]
	l1 = [int(k) for k in input().split()]
	l = 0
	count = 0
	for j in range(len(l1)):
		if l + l1[j] >= k:
			l += l1[j] - k
			count += 1
		else:
			print('NO', j + 1)
			break
	if count == len(l1):
		print('YES')


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	count = 0
	diff = 0
	for i in range(a):
		count += l[i]
		if b > count:
			diff = i + 1
			break
		else:
			count -= b
	if diff == 0:
		print('YES')
	else:
		print('NO', diff)


t = int(input())
for i in range(t):
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))
	c = 0
	d = 0
	for i in range(N):
		c += A[i]
		if K > c:
			d = i + 1
			break
		else:
			c -= K
	if d == 0:
		print('YES')
	else:
		print('NO', d)


T = int(input())
while T > 0:
	(N, K) = [int(x) for x in input().split()]
	L = [int(y) for y in input().split()]
	if L[0] < K:
		print('NO 1')
	else:
		prev = L[0]
		for i in range(1, len(L)):
			now = prev - K
			prev = now + L[i]
			if prev < K:
				print('NO', i + 1)
				break
		else:
			print('YES')
	T = T - 1


for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	a = 0
	b = 0
	for i in range(len(l)):
		b = b + l[i]
		if b >= k:
			b = b - k
		else:
			a = 1
			print('NO', i + 1)
			break
	if a == 0:
		print('YES')


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	k1 = 0
	f = 'YES'
	for i in range(len(l)):
		t = k1 + l[i]
		if t < k:
			f = 'NO ' + str(i + 1)
			break
		else:
			k1 = abs(k - t)
	print(f)


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))
	protein = 0
	flag = 0
	for i in range(N):
		protein += A[i]
		if protein < K:
			flag = i + 1
			break
		else:
			protein -= K
	if flag == 0:
		print('YES')
	else:
		print('NO', flag)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	count = 0
	f = 0
	for j in range(n):
		a[j] = count + a[j]
		if a[j] < k:
			f = 1
			print('NO ', j + 1)
			break
		else:
			count = a[j] - k
	if f == 0:
		print('YES')


T = int(input())
for i in range(T):
	(N, K) = map(int, input().split(' '))
	A = list(map(int, input().split(' ')))
	c = 0
	a = []
	for i in A:
		c += i
		c -= K
		if c < 0:
			a.append('NO')
		else:
			a.append('YES')
	if 'NO' in a:
		print('NO', a.index('NO') + 1)
	else:
		print('YES')


tests = int(input())
for i in range(tests):
	grams_list = []
	[days, gram] = input().split()
	days = int(days)
	gram = int(gram)
	for j in input().split():
		grams_list.append(int(j))
	for k in range(days):
		if grams_list[k] - gram >= 0:
			rem = grams_list[k] - gram
			if k == days - 1:
				print('YES')
				break
			else:
				grams_list[k + 1] = grams_list[k + 1] + rem
		else:
			print(f'NO {k + 1}')
			break


for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	(s, d) = (0, 0)
	for i in range(len(l)):
		s = s + l[i] + d
		if s >= k:
			d = s - k
			s = 0
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO', i + 1)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	for i in range(n):
		if l[i] >= k and i != n - 1:
			l[i + 1] = l[i + 1] - k + l[i]
			flag = 1
		elif l[i] < k:
			print('NO', i + 1)
			flag = 0
			break
	if flag and l[n - 1] >= k:
		print('YES')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split(' '))
	lst = list(map(int, input().split(' ')))
	car = 0
	flag = True
	for j in range(len(lst)):
		if lst[j] + car < k:
			print('NO {}'.format(j + 1))
			flag = False
			break
		else:
			car = lst[j] + car - k
	if flag:
		print('YES')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	extra = 0
	for i in range(n):
		if extra + a[i] < k:
			print('NO ', i + 1)
			break
		else:
			extra += a[i] - k
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	lis = list(map(int, input().split()))
	p = 0
	for i in range(a):
		p = p + (lis[i] - b)
		if p < 0:
			print('NO ' + str(i + 1))
			break
	if i == a - 1 and p >= 0:
		print('YES')


t = int(input())
for _ in range(t):
	(n, t) = map(int, input().split())
	prot = list(map(int, input().split()))
	ans = []
	for j in range(n - 1):
		x = prot[j] - t
		if x > 0:
			prot[j + 1] = prot[j + 1] + x
	for k in range(1, n + 1):
		if prot[k - 1] >= t:
			ans.append('YES')
		else:
			ans.append('NO')
	if 'NO' in ans:
		print('NO ', ans.index('NO') + 1)
	else:
		print('YES')


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	extra = 0
	i = 0
	flag = True
	for i in range(n):
		if a[i] + extra < k:
			print('NO', i + 1)
			flag = False
			break
		else:
			extra = abs(a[i] + extra - k)
	if flag:
		print('YES')
	t = t - 1


for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	flag = True
	for i in range(len(l)):
		if l[i] >= k:
			l[i] -= k
		else:
			flag = False
			print('NO' + ' ' + str(i + 1))
			break
		if i < len(l) - 1:
			l[i + 1] += l[i]
	if flag == True:
		print('YES')


for i in range(int(input())):
	(N, K) = map(int, input().split())
	n = list(map(int, input().split()))
	c = 0
	flag = True
	for i in range(len(n)):
		if n[i] + c < K:
			print('NO', i + 1)
			flag = False
			break
		else:
			c += n[i] - K
	if flag:
		print('YES')


t = int(input())
for i in range(t):
	storage = 0
	(n, grams) = map(int, input().split())
	a = [int(x) for x in input().split()]
	for j in range(n):
		if a[j] - grams >= 0:
			if j != n - 1:
				storage = a[j] - grams
				a[j + 1] = a[j + 1] + storage
				storage = 0
			else:
				print('YES')
		else:
			print(f'NO {j + 1}')
			break


def check(days, pro, arr):
	remain = 0
	flag = True
	ind = 0
	for i in arr:
		ind += 1
		if i >= pro:
			remain += i - pro
		elif i + remain >= pro:
			remain -= pro - i
		else:
			flag = False
			print('NO', ind)
			break
	if flag:
		print('YES')
for i in range(int(input())):
	(days, pro) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	check(days, pro, arr)


T = int(input())
for i in range(T):
	(N, K) = list(map(int, input().split()))
	l1 = list(map(int, input().split()))
	l = 0
	c = 0
	for j in range(len(l1)):
		if l + l1[j] >= K:
			l += l1[j] - K
			c += 1
		else:
			print('NO', j + 1)
			break
	if c == len(l1):
		print('YES')


t = int(input())

def check(n, k, ailst):
	ailst.append(-1)
	for i in range(n):
		if ailst[i] < k:
			return 'NO {}'.format(i + 1)
		else:
			ailst[i + 1] = ailst[i + 1] + (ailst[i] - k)
	return 'YES'
for j in range(t):
	lst = list(map(int, input().split()))
	(N, K) = (lst[0], lst[1])
	Ailst = list(map(int, input().split()))
	print(check(N, K, Ailst))


n = int(input())
for i in range(n):
	(p, k) = [int(x) for x in input().split()]
	q = list(map(int, input().split()))
	l = 0
	o = 0
	for i in q:
		i = i + l
		l = i - k
		if l >= 0:
			o = o + 1
		if l < 0:
			print('NO', o + 1)
			break
		if o == len(q):
			print('YES')