$m$ chairs are arranged in a circle sequentially. The chairs are numbered from $0$ to $m-1$. $n$ people want to sit in these chairs. The $i$-th of them wants at least $a[i]$ empty chairs both on his right and left side.

More formally, if the $i$-th person sits in the $j$-th chair, then no one else should sit in the following chairs: $(j-a[i]) mod m$, $(j-a[i]+1) mod m$, ... $(j+a[i]-1) mod m$, $(j+a[i]) mod m$.

Decide if it is possible to sit down for all of them, under the given limitations.


-----Input-----

The input consists of multiple test cases. The first line contains a single integer $t$ ($1 \leq t \leq 5 \cdot 10^4$) — the number of test cases. The description of the test cases follows.

The first line of each test case contains two integers $n$ and $m$ ($2 \leq n \leq 10^5$, $1 \leq m \leq 10^9$) — the number of people and the number of chairs.

The next line contains $n$ integers, $a_1$, $a_2$, ... $a_n$ ($1 \leq a_i \leq 10^9$) — the minimum number of empty chairs, on both sides of the $i$-th person.

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


-----Output-----

For each test case print "YES" (without quotes) if it is possible for everyone to sit down and fulfil the restrictions, and "NO" (without quotes) otherwise.

You may print every letter in any case you want (so, for example, the strings "yEs", "yes", "Yes" and "YES" will all be recognized as positive answers).


-----Examples-----

Input
6
3 2
1 1 1
2 4
1 1
2 5
2 1
3 8
1 2 1
4 12
1 2 1 3
4 19
1 2 1 3
Output
NO
YES
NO
YES
NO
YES


-----Note-----

Test case $1$: $n>m$, so they can not sit down.

Test case $2$: the first person can sit $2$-nd and the second person can sit in the $0$-th chair. Both of them want at least $1$ empty chair on both sides, chairs $1$ and $3$ are free, so this is a good solution.

Test case $3$: if the second person sits down somewhere, he needs $2$ empty chairs, both on his right and on his left side, so it is impossible to find a place for the first person, because there are only $5$ chairs.

Test case $4$: they can sit in the $1$-st, $4$-th, $7$-th chairs respectively.

Difficulty: EASY

Solutions:
import sys
input = sys.stdin.readline

def solve():
	(n, m) = map(int, input().split())
	a = [*map(int, input().split())]
	if n >= m:
		return 'NO'
	elif m >= n + sum(a) + max(a) - min(a):
		return 'YES'
	else:
		return 'NO'
for _ in [0] * int(input()):
	print(solve())


import sys
input = sys.stdin.readline

def ri():
	return int(input())

def rf():
	return list(map(float, input().split()))

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

def rs():
	return input().rstrip()

def out_list(x):
	return ' '.join(map(str, x))

def solve_case():
	(n, m) = rl()
	A = rl()
	if n > m:
		print('NO')
		return
	need = n
	if n == 2:
		need += max(A) * 2
	else:
		need += sum(A) + max(A) - min(A)
	if need > m:
		print('NO')
	else:
		print('YES')
T = ri()
for ti in range(1, T + 1):
	solve_case()


import sys

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

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

def main():
	for _ in range(int(input())):
		(n, m) = get_ints()
		ls = get_ls()
		res = 0
		for x in ls:
			res += x
		res = res - min(ls) + max(ls) + n
		if n > m or res > m:
			print('NO')
		else:
			print('YES')
main()


from sys import stdin
t = int(stdin.readline())
while t > 0:
	t -= 1
	(n, m) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	print('YES' if n + sum(a) - min(a) + max(a) <= m else 'NO')


def solve(arr):
	if n > m:
		return 'NO'
	arr.sort()
	x = 0
	for i in range(n - 1):
		x += 1
		x += arr[i + 1]
	x += 1
	x += arr[-1]
	if x > m:
		return 'NO'
	return 'YES'
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, m) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	print(solve(arr))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	if n >= m:
		print('NO')
		continue
	if sum(a) + n + max(a) - min(a) <= m:
		print('YES')
	else:
		print('NO')


import sys
DEBUG = False

def check(m, req):
	req = list(sorted(req, reverse=True))
	left = req[::2]
	right = req[1::2]
	ar = right + left
	space = 0
	if len(req) == 1:
		return 1 <= m
	if len(req) == 2:
		return 2 + max(req) * 2 <= m
	space += sum(left[:-1]) + len(left[:-1]) + sum(right[:-1]) + len(right[:-1])
	space += 2 + max(left[-1], right[-1])
	space += max(left[0], right[0])
	return space <= m

def main(f):
	t = int(f.readline())
	for i in range(t):
		(n, m) = map(int, f.readline().split())
		req = list(map(int, f.readline().split()))
		if check(m, req):
			print('YES')
		else:
			print('NO')
if DEBUG:
	f = open('input.txt', 'r')
else:
	f = sys.stdin
main(f)
f.close()


import sys, math
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	x = 0
	if a == 1:
		x = l[0] + 1
	else:
		for i in range(1, a + 1):
			if i == 1:
				x = x + 2 * l[-1 * i] + 1
			elif i == a:
				x = x + 1
			else:
				x = x + l[-1 * i] + 1
	if x <= b:
		print('YES')
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().strip()
for i in range(int(input())):
	(n, m) = map(int, input().split())
	arr = sorted(list(map(int, input().split())))
	x = arr[-1]
	arr = arr[1:]
	y = sum(arr)
	y += n
	y += x
	print('YES' if y <= m else 'NO')


import sys
input = sys.stdin.readline

def solve():
	(n, m) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr.sort(key=lambda x: -x)
	curr = m - 1 - 2 * arr[0]
	for i in range(1, n):
		if curr <= 0:
			return 'NO'
		curr -= 1 + arr[i]
	return 'YES'
for _ in range(int(input())):
	print(solve())


from sys import stdin
T = int(stdin.readline())

def solve(a, nc):
	a.sort()
	a = a[::-1]
	s = a[0]
	for i in range(len(a) - 1):
		s += a[i] + 1
	return s < nc
for t in range(T):
	[np, nc] = [int(x) for x in stdin.readline().strip().split(' ')]
	a = [int(x) for x in stdin.readline().strip().split(' ')]
	if solve(a, nc):
		print('YES')
	else:
		print('NO')


from sys import stdin
from math import log, floor, ceil, gcd
from collections import defaultdict as dd
input = stdin.readline
inp = lambda : int(stdin.readline())
rs = lambda : stdin.readline().strip()

def ra(typ):
	return list(map(typ, stdin.readline().split()))

def rv(typ):
	return map(typ, stdin.readline().split())

def main():
	for _ in range(inp()):
		(n, m) = rv(int)
		a = sorted(ra(int))
		a.append(a[0])
		x = n
		for i in range(n):
			x += max(a[i], a[i + 1])
		print('YES' if x <= m else 'NO')
main()


t = int(input())
rr = ''
yes = 'YES'
no = 'NO'
for _t in range(t):
	(n, m) = map(int, input().split())
	arr = list(map(int, input().split()))
	r = yes
	arr = sorted(arr, reverse=True)
	if n > m:
		r = no
	elif n + 2 * arr[0] + sum(arr[1:-1]) > m:
		r = no
	rr += r + '\n'
print(rr)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	w = sorted(map(int, input().split()))
	w = w + [w[0]]
	s = n
	for i in range(n):
		s += max(w[i], w[i + 1])
	print('YES' if m >= s else 'NO')


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 i in range(t):
	(n, m) = mp()
	l = li()
	l.sort()
	c1 = l[0] + 1
	c2 = l[0]
	for i in range(1, n):
		if l[i] > c2:
			a = l[i] - c2
			c1 += a
		c1 += l[i] + 1
		c2 = l[i]
	if c1 <= m:
		pr('YES')
	else:
		pr('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	arr.sort()
	seats = 0
	for i in range(1, n):
		seats += 1 + max(arr[i - 1], arr[i])
	seats += 1 + max(arr[n - 1], arr[0])
	print('YES' if seats <= m else 'NO')


import fileinput

def getanswer(Np, Nc, gaps):
	gaps.sort()
	gaps = gaps[1:]
	gaps = gaps + [max(gaps)]
	if Nc - sum(gaps) >= Np:
		return 'YES'
	else:
		return 'NO'

def solve():
	ins = []
	for line in fileinput.input():
		ins.append(line.strip('\n'))
	num_tests = int(ins[0])
	test_cases = ins[1:]
	for i in range(num_tests):
		(NpNc, gaps) = test_cases[2 * i:2 * i + 2]
		(Np, Nc) = NpNc.split(' ')
		gaps = [int(i) for i in gaps.split(' ')]
		answer = getanswer(int(Np), int(Nc), gaps)
		print(answer)
solve()


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
GAP = 2
for t in [wtf[i:i + GAP] for i in range(1, len(wtf), GAP)]:
	(n, m) = map(int, t[0].split())
	A = sorted(map(int, t[1].split()), reverse=True)
	L = 0
	R = m - 1
	for a in A:
		l = L + a + 1
		if R < L:
			m = -1
			break
		if l < m:
			if L == 0:
				R -= a
			L = l
			continue
		r = R - a
		if r < m:
			if R == m - 1:
				L += a + 1
			R = r
			continue
		m = -1
		break
	print('NO' if m < n else 'YES')


def value(chair, array):
	if chair < len(array):
		return 'NO'
	array.sort(reverse=True)
	chair -= 1 + 2 * array[0]
	for i in range(1, len(array) - 1):
		chair -= 1 + array[i]
		if chair <= 0:
			return 'NO'
	if chair > 0:
		return 'YES'
	else:
		return 'NO'

def main():
	n = int(input())
	data = []
	chairs = []
	for i in range(n):
		(people, chair) = map(int, input().split())
		array = list(map(int, input().split()))
		chairs.append(chair)
		data.append(array)
	for k in range(n):
		print(value(chairs[k], data[k]))
main()


import sys
input = sys.stdin.readline
from math import ceil, floor, gcd

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

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

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

def st():
	return input().rstrip('\n')

def isPrime(n):
	if n == 1:
		return 0
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return 0
	return 1
t = inp()
for _ in range(t):
	(n, m) = map(int, input().split())
	a = lis()
	ma = 1
	fl = 1
	gap = 0
	a.sort()
	for i in range(n):
		if ma - 1 > m:
			fl = -1
			break
		if a[i] > gap:
			ma += abs(a[i] - gap) + 1
		else:
			ma += 1
		if i != 0 and i != n - 1:
			ma += a[i]
		gap = a[i]
	ma -= 1
	if ma > m:
		fl = -1
	if fl == -1:
		print('NO')
		continue
	if m - ma >= a[-1] and m - ma >= a[0]:
		pass
	else:
		fl = -1
	if fl == 1:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict
from sys import stdin, stdout
import io
import math
import heapq
import bisect
import collections

def ceil(a, b):
	return (a + b - 1) // b
inf = float('inf')

def get():
	return stdin.readline().rstrip()
mod = 10 ** 5 + 7
for _ in range(int(get())):
	(n, m) = map(int, get().split())
	l = list(map(int, get().split()))
	l.sort()
	x = 0
	for i in range(n - 1):
		x += max(l[i], l[i + 1])
	x += abs(max(l[0], l[-1])) + n
	if x <= m:
		print('YES')
	else:
		print('NO')


t = int(input())
otv = ['NO'] * t
for T in range(t):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	if n >= m:
		continue
	s = a.pop(a.index(max(a))) * 2 + 1
	for i in range(n - 1):
		s += a[i] + 1
	s -= min(a)
	if s <= m:
		otv[T] = 'YES'
for i in range(t):
	print(otv[i])


test_cases = input()
arr1 = []
arr2 = []
arr3 = []
for i in range(int(test_cases)):
	arr1.append(list(map(int, input().split())))
	arr2.append(list(map(int, input().split())))
for (i, e) in enumerate(arr1):
	chair_needed = 0
	temp_arr = arr2[i]
	temp_arr.sort()
	for (ii, j) in enumerate(temp_arr):
		if ii == len(temp_arr) - 1:
			chair_needed += max(j, temp_arr[0])
		else:
			chair_needed += max(j, temp_arr[ii + 1])
	chair_needed += e[0]
	if e[1] >= chair_needed:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	if sum(a) - min(a) + max(a) + n > m:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	(n, m) = [int(x) for x in input().split()]
	l = [int(x) for x in input().split()]
	l.sort()
	min = n
	min += l[-1] * 2
	for i in l[1:-1]:
		min += i
	if m >= min:
		print('YES')
	else:
		print('NO')
	t = t - 1


t = int(input())
for __ in range(t):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	sumi = sum(a) + a[-1] - a[0] + n
	if sumi <= m:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	s = sum(a[1:])
	s += a[-1] + n
	if s <= m:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	(n, m) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	r = max(a) + sum(a) + n - min(a)
	if r <= m:
		print('YES')
	else:
		print('NO')


def solve():
	(n, m) = list(map(int, input().split(' ')))
	a = list(map(int, input().split(' ')))
	a.sort()
	chair_occupied = sum(a) + n + a[-1] - a[0]
	if chair_occupied > m:
		print('NO')
	else:
		print('YES')
for t in range(int(input())):
	solve()


n = int(input())
for p in range(0, n):
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	l = []
	a = input().split()
	for i in range(0, n):
		l.append(int(a[i]))
	l.sort()
	sum = 2 * l[n - 1] + n
	for i in range(1, n - 1):
		sum = sum + l[i]
	if sum <= m:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, m) = map(int, input().split())
	values = list(map(int, input().split()))
	values.sort()
	if n + sum(values) - values[0] + values[n - 1] <= m:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	(n, m) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	a.sort(reverse=True)
	if n >= m:
		print('NO')
	else:
		m -= n
		m -= 2 * a[0]
		j = 1
		while m >= 0 and j < n - 1:
			m -= a[j]
			j += 1
		if m >= 0:
			print('YES')
		else:
			print('NO')


def Dist():
	num_nm = input().split()
	m = int(num_nm[1])
	n = int(num_nm[0])
	a = input().split()
	a = list(map(int, a))
	a = sorted(a)
	rep = max(a[0], a[n - 1])
	if n == 2:
		wish = 2 * rep + n
	else:
		for i in range(n - 1):
			rep += max(a[i - 1], a[i])
		wish = rep + n
	if wish > m:
		print('NO')
	else:
		print('YES')
num_iter = int(input())
for _ in range(num_iter):
	Dist()


lines = int(input())
for i in range(lines):
	line1 = input().split()
	n = int(line1[0])
	m = int(line1[1])
	line2 = [int(x) for x in input().split()]
	line2.sort()
	line2.reverse()
	seatReq = 2 * line2[0] + 1
	for i in range(1, n - 1):
		seatReq += 1 + line2[i]
	seatReq += 1
	if seatReq <= m:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = a + sum(arr) + (arr[-1] - arr[0])
	if ans <= b:
		print('YES')
	else:
		print('NO')


def solution():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		seats_empty = list(map(int, input().split()))
		seats_empty.sort(reverse=True)
		res = seats_empty[0] * 2 + 1
		for seats in seats_empty[1:n - 1]:
			res += seats + 1
		res += 0 if n == 1 else 1
		if res > m:
			print('NO')
		else:
			print('YES')
solution()


T = int(input())
for t in range(T):
	(n, m) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	answer = sum(a) + max(a) - min(a) + n
	if answer > m:
		print('NO')
	else:
		print('YES')


I = lambda : [int(i) for i in input().split()]
for _ in range(I()[0]):
	(n, m) = I()
	l = sorted(I(), reverse=True)
	print('YES' if l[0] + sum(l[:-1]) + n <= m else 'NO')


for i in range(int(input())):
	(peep, chair) = map(int, input().split())
	a = list(map(int, input().split()))
	final = max(a) + sum(a) + peep - min(a)
	if chair >= final:
		print('YES')
	else:
		print('NO')


def Dist():
	num_nm = input().split()
	m = int(num_nm[1])
	n = int(num_nm[0])
	a = input().split()
	a = list(map(int, a))
	wish = n + sum(a) - min(a) + max(a)
	print('NO' if wish > m else 'YES')
num_iter = int(input())
for _ in range(num_iter):
	Dist()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	c = 1
	a.sort()
	for i in range(1, n - 1):
		c += a[i] + 1
	if c + 2 * a[-1] + 1 > m:
		print('NO')
	else:
		print('YES')


t = int(input())
for j in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if n > k:
		print('NO')
		continue
	a = sorted(a)
	if sum(a) + a[n - 1] + n - a[0] <= k:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(col, chairs) = map(int, input().split())
	sp_dist = list(map(int, input().split()))
	min_chairs = max(sp_dist) + sum(sp_dist) - min(sp_dist) + col
	if min_chairs <= chairs:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	s = a[0] + n
	for i in a[:-1]:
		s += i
	if s > m:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	if n > m:
		print('NO')
	else:
		l.sort()
		s = n + sum(l) - l[0] + l[-1]
		if m < s:
			print('NO')
		else:
			print('YES')
	t -= 1


for i in range(int(input())):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	j = l[0] * 2 + 1
	t = 1
	while j < m and t < n:
		j += l[t] + 1
		t += 1
	if t < n:
		print('NO')
	else:
		print('YES')


def solve():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	zasedeni = 0
	a.sort(reverse=True)
	if n > m:
		return 'NO'
	zasedeni = a[0] + 1
	for i in a[:-1]:
		zasedeni += i + 1
		if zasedeni > m:
			return 'NO'
	return 'YES'
t = int(input())
while t > 0:
	print(solve())
	t -= 1


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = sorted(list(map(int, input().split())), reverse=True)
	x = sum(a) + n + a[0] - a[-1]
	if x <= m:
		print('YES')
	else:
		print('NO')


t = int(input())

def changer(a):
	if a == '1':
		return '0'
	return '1'

def solve():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	if sum(a) + max(a) - min(a) + n > m:
		print('NO')
		return
	print('YES')
for i in range(t):
	solve()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	l = sorted(l)
	l = l[::-1]
	temp = sum(l)
	if temp + n + l[0] - l[-1] <= m:
		print('YES')
	else:
		print('NO')


t = int(input())

def sou():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	if n >= m:
		return False
	a.sort(reverse=True)
	t = a[0]
	p = a[0]
	for i in range(len(a)):
		if t + 1 > m:
			return False
		t += a[i] + 1
	return True
while t:
	if sou():
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	res = 0
	for i in arr[:-1]:
		res += i + 1
	res += 1
	rem = m - res
	if rem >= arr[0]:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m) = [int(c) for c in input().split()]
	a = [int(d) for d in input().split()]
	if n > m:
		print('NO')
		continue
	a.sort(reverse=True)
	needed = n + a[0] + sum(a[:-1])
	print('YES' if needed <= m else 'NO')


for _ in range(int(input())):
	(guys, chairs) = list(map(int, input().split()))
	dist = list(map(int, input().split()))
	if guys > chairs:
		print('NO')
	elif guys == 1:
		print('YES')
	elif chairs < guys + sum(dist) + max(dist) - min(dist):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = [*map(int, input().split())]
	a = sorted(a)
	D = sum(a[1:]) + a[-1] + n
	if D > m:
		print('NO')
	else:
		print('YES')


def solve(n, m, a: list):
	if n > m:
		return 'NO'
	a.sort(reverse=True)
	need = n + 2 * a[0]
	for (i, num) in enumerate(a):
		if i == 0 or i == len(a) - 1:
			continue
		need += num
	if m >= need:
		return 'YES'
	else:
		return 'NO'

def main():
	t = int(input())
	for _ in range(t):
		(n, m) = map(int, input().split())
		a = list(map(int, input().split()))
		ans = solve(n, m, a)
		print(ans)
main()


for _ in range(int(input())):
	(p, ch) = map(int, input().split())
	s = list(map(int, input().split()))
	s.sort()
	c = 0
	if p + sum(s) - s[0] + s[p - 1] <= ch:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
import math as m

def get2int():
	p = input().split()
	return (int(p[0]), int(p[1]))

def get3int():
	p = input().split()
	return (int(p[0]), int(p[1]), int(p[2]))

def cinarr():
	arr = []
	for i in input().split():
		arr.append(int(i))
	return arr

def solve():
	(n, m) = get2int()
	a = cinarr()
	sm = 0
	if n > m:
		return 'NO'
	a.sort(reverse=True)
	a[0] = a[0] * 2
	for i in range(n - 1):
		sm += a[i] + 1
	sm += 1
	if sm > m:
		return 'NO'
	else:
		return 'YES'
for case in range(int(input())):
	print(solve())


t = int(input())
while t:
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	ans = sum(l) + max(l) + n - min(l)
	if m >= ans:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	ans = 2 * l[0] + 1
	for i in range(1, n - 1):
		ans += l[i] + 1
	if n > 1:
		ans += 1
	if ans <= k:
		print('YES')
	else:
		print('NO')


import math

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

def stringlist():
	return input().split(' ')

def yes(t):
	if t:
		return 'YES'
	return 'NO'

def printjoin(l, str=False):
	if str:
		l = [str(i) for i in l]
	return ' '.join(l)

def power_of_two(n):
	b = bin(n)[2:]
	return int(b) == 10 ** (len(b) - 1)

def bit_count(n):
	return bin(n).count('1')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	lcm = x * y // gcd(x, y)
	return lcm

def isint(str):
	try:
		int(str)
		return True
	except ValueError:
		return False

def solve():
	(n, m) = intlist()
	l = intlist()
	if n > m:
		return 'NO'
	l = sorted(l, reverse=True)
	a = sum(l) + n
	a -= l[-1]
	a += l[0]
	return yes(a <= m)
t = input()
for tt in range(int(t)):
	print(solve())


for _ in range(int(input())):
	result = True
	(n, m) = input().split()
	n = int(n)
	m = int(m)
	people = [int(x) for x in input().split()]
	people.sort(reverse=True)
	m -= people[0] + 1
	for i in range(1, n):
		m -= people[i - 1] + 1
		if m < 0:
			result = False
			break
	print('YES' if result else 'NO')


t = lambda : map(int, input().split())
for _ in range(int(input())):
	(n, m) = t()
	a = [*t()]
	print('YNEOS'[sum(a) + max(a) - min(a) + n > m::2])


tc = int(input())
for i in range(tc):
	(n, m) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr.sort()
	sum = 1
	for j in range(n - 1):
		sum = sum + arr[j + 1] + 1
	sum = sum + arr[n - 1]
	if n >= m:
		print('NO')
	elif sum <= m:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = input().split()
	(n, m) = (int(a[0]), int(a[1]))
	l = input().split()
	for i in range(n):
		l[i] = int(l[i])
	ans = 0
	prev = 1000000000
	l.sort()
	for i in l:
		ans += i + 1
		if prev < i:
			ans += i - prev
		prev = i
	print('YES') if ans <= m else print('NO')


def socialDistance(A, n, m):
	if n > m:
		print('NO')
		return
	A.sort()
	total_chairs = m
	total_chairs -= 1
	total_chairs -= 2 * A[len(A) - 1]
	if total_chairs <= 0:
		print('NO')
		return
	for i in range(len(A) - 2, -1, -1):
		total_chairs -= 1
		if i == 0 and total_chairs >= 0:
			print('YES')
			return
		total_chairs -= A[i]
		if total_chairs < 0:
			print('NO')
			return
	print('YES')
t = int(input())
for i in range(t):
	(n, m) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	socialDistance(A, n, m)


a = int(input())
for i in range(a):
	(b, c) = map(int, input().split())
	d = [*map(int, input().split())]
	d.sort()
	e = sum(d[1:]) + d[-1] + b
	if e > c:
		print('NO')
	else:
		print('YES')


R = lambda : map(int, input().split())
(t,) = R()
while t:
	t -= 1
	(n, m) = R()
	a = (*R(),)
	print('YNEOS'[sum(a) + max(a) - min(a) + n > m::2])


import re

class Util:
	ALLOWED_LOCAL_FILES = set(['main.py', 'A.py', 'B.py', 'C.py', 'D.py', 'E.py', 'F.py', 'G.py'])
	MOD = 1000000000 + 7

	@staticmethod
	def get_int_list_input():
		return list(map(int, input().split()))

def solve():
	(n, m) = Util.get_int_list_input()
	a = Util.get_int_list_input()
	extra_chairs = sum(a) - min(a) + max(a)
	required_chairs = n + extra_chairs
	if required_chairs > m:
		print('NO')
	else:
		print('YES')

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()
import sys
if sys.argv[0] in Util.ALLOWED_LOCAL_FILES:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
main()


import math
t = int(input())
for i in range(t):
	(n, m) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	rChairs = n + sum(a) + (max(a) - min(a))
	if rChairs <= m:
		print('YES')
	else:
		print('NO')


import sys

def solve():
	(n, m) = map(int, input().split())
	num = list(map(int, input().split()))
	num.sort()
	s = sum(num[1:]) + num[-1] + n
	print('YES' if s <= m else 'NO')
for _ in range(int(input())):
	solve()