Rachel has some candies and she decided to distribute them among $N$ kids. The ith kid receives $A_i$ candies. The kids are happy iff the difference between the highest and lowest number of candies received is less than $X$.
Find out if the children are happy or not.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- The first line contains $N$ and $X$. 
- The second line contains $N$ integers $A_1,A_2,...,A_N$. 

-----Output:-----
For each test case print either "YES"(without quotes) if the kids are happy else "NO"(without quotes)

-----Constraints-----
- $1 \leq T \leq 100$
- $1 \leq N, X \leq 10^5$
- $1 \leq A_i \leq 10^5$

-----Sample Input:-----
2

5 6

3 5 6 8 1

3 10

5 2 9

-----Sample Output:-----
NO

YES

-----EXPLANATION:-----
- Example 1: Difference between maximum and minimum candies received is 8-1=7. 7 is greater than 6, therefore, the kids are not happy.

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
t = int(input())
for t1 in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	mx = max(a)
	mn = min(a)
	if mx - mn < x:
		print('YES')
	else:
		print('NO')


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


t = int(input())
for _ in range(t):
	(N, X) = map(int, input().split())
	A = list(map(int, input().split()))
	x = max(A)
	y = min(A)
	if x - y < X:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	n = l[0]
	x = l[1]
	p = list(map(int, input().split()))
	pmax = max(p)
	pmin = min(p)
	if pmax - pmin < x:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	(m, n) = map(int, input().split())
	a = list(map(int, input().strip().split()))[:m]
	if max(a) - min(a) < n:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	arr = list(map(int, input().split()))
	m = max(arr) - min(arr)
	if m < b:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	l1 = list(map(int, input().split()))
	l1.sort()
	diff = l1[-1] - l1[0]
	if k < diff:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	(r, c) = list(map(int, input().split()))
	lst = list(map(int, input().split()))
	(maxx, minn) = (max(lst), min(lst))
	if maxx - minn < c:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	if max(arr) - min(arr) < x:
		print('YES')
	else:
		print('NO')


try:
	n = int(input())
	for i in range(n):
		(c, x) = input().split()
		l = list(map(int, input().split()))
		(l_min, l_max) = (min(l), max(l))
		if l_max - l_min > int(x):
			print('NO')
		else:
			print('YES')
except:
	pass


t = int(input())
while t > 0:
	(n, x) = map(int, input().split())
	candies = list(map(int, input().split()))
	max_candies = max(candies)
	min_candies = min(candies)
	if max_candies - min_candies < x:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	m = max(l)
	n = min(l)
	if m - n < k:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(0, n):
	p = input().rstrip().split(' ')
	q = input().rstrip().split(' ')
	x = int(p[1])
	q.sort(key=int)
	A = int(q[0])
	B = int(q[len(q) - 1])
	C = abs(A - B)
	if C < x:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	if max(a) - min(a) < k:
		print('YES')
	else:
		print('NO')


n = int(input())
while n > 0:
	n = n - 1
	lst = []
	(P, X) = map(int, input().split())
	lst = list(map(int, input().split()))
	d = max(lst) - min(lst)
	if d < X:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	if max(l) - min(l) < b:
		print('YES')
	else:
		print('NO')
	t -= 1


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


T = int(input())
while T:
	nx = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	if max(A) - min(A) < nx[1]:
		print('YES')
	else:
		print('NO')
	T = T - 1


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	candies = list(map(int, input().split()))
	min_candy = min(candies)
	max_candy = max(candies)
	if max_candy - min_candy < x:
		print('YES')
	else:
		print('NO')


from sys import stdout, stdin

def main():
	(numOfKids, difference) = list(map(str, input().split()))
	numbers = [int(x) for x in stdin.readline().split()]
	numOfKids = int(numOfKids)
	difference = int(difference)
	smallest = largest = numbers[0]
	for j in range(1, len(numbers)):
		if smallest > numbers[j]:
			smallest = numbers[j]
			min_position = j
		if largest < numbers[j]:
			largest = numbers[j]
			max_position = j
	listDiff = largest - smallest
	if listDiff > difference:
		print('NO')
	elif difference > listDiff:
		print('YES')
	elif difference == listDiff:
		print('NO')

def __starting_point():
	testCases = int(stdin.readline())
	if 0 <= testCases <= 100:
		for _ in range(testCases):
			main()
__starting_point()


n = int(input())
for i in range(1, n + 1):
	r = [int(r) for r in input().split()]
	y = [int(y) for y in input().split()]
	y.sort()
	j = 0
	j = r[0]
	diff = int(y[j - 1] - y[0])
	if diff < r[1]:
		print('YES')
		diff = 0
	else:
		print('NO')
		diff = 0


try:
	n = int(input())
	for _ in range(n):
		(a, b) = map(int, input().split())
		l = list(map(int, input().split()))
		x1 = max(l)
		x2 = min(l)
		if x1 - x2 < b:
			print('YES')
		else:
			print('NO')
except:
	pass