You are given two arrays $a$ and $b$, each consisting of $n$ positive integers, and an integer $x$. Please determine if one can rearrange the elements of $b$ so that $a_i + b_i \leq x$ holds for each $i$ ($1 \le i \le n$).


-----Input-----

The first line of input contains one integer $t$ ($1 \leq t \leq 100$) — the number of test cases. $t$ blocks follow, each describing an individual test case.

The first line of each test case contains two integers $n$ and $x$ ($1 \leq n \leq 50$; $1 \leq x \leq 1000$) — the length of arrays $a$ and $b$, and the parameter $x$, described in the problem statement.

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_1 \le a_2 \le \dots \le a_n \leq x$) — the elements of array $a$ in non-descending order.

The third line of each test case contains $n$ integers $b_1, b_2, \ldots, b_n$ ($1 \leq b_1 \le b_2 \le \dots \le b_n \leq x$) — the elements of array $b$ in non-descending order.

Test cases are separated by a blank line.


-----Output-----

For each test case print Yes if one can rearrange the corresponding array $b$ so that $a_i + b_i \leq x$ holds for each $i$ ($1 \le i \le n$) or No otherwise.

Each character can be printed in any case.


-----Example-----
Input
4
3 4
1 2 3
1 1 2

2 6
1 4
2 5

4 4
1 2 3 4
1 2 3 4

1 5
5
5

Output
Yes
Yes
No
No



-----Note-----

In the first test case, one can rearrange $b$ so it'll look like $[1, 2, 1]$. In this case, $1 + 1 \leq 4$; $2 + 2 \leq 4$; $3 + 1 \leq 4$.

In the second test case, one can set $b$ to $[5, 2]$, then $1 + 5 \leq 6$; $4 + 2 \leq 6$.

In the third test case, no matter how one shuffles array $b$, $a_4 + b_4 = 4 + b_4 > 4$.

In the fourth test case, there is only one rearrangement of array $b$ and it doesn't satisfy the condition since $5 + 5 > 5$.

Difficulty: EASY
Tags: Sorting

Greedy algorithms
Skill types: Sorting

Greedy algorithms

Starter code:

Solutions:
for _ in range(int(input()) - 1):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	p = 1
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			print('No')
			p = 0
			break
	if p == 1:
		print('Yes')
	input()
(n, x) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p = 1
for i in range(n):
	if a[i] + b[n - i - 1] > x:
		print('No')
		p = 0
		break
if p == 1:
	print('Yes')


import math
import sys

def chek(m, b, c, li):
	for i in range(li):
		if m[i] + b[i] > c:
			return False
	return True
input = lambda : sys.stdin.readline().rstrip()
f = int(input())
for _ in range(f):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	p = list(map(int, input().split()))
	a = sorted(a)
	p = sorted(p)
	if chek(a, p, x, n) or chek(a[::-1], p, x, n) or chek(a, p[::-1], x, n):
		print('Yes')
	else:
		print('No')
	if _ != f - 1:
		s = input()


def aint():
	arr = input().split()
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	return arr

def amax(a, b, n, x):
	if n == 0:
		print('YES')
		return
	t = [0, 0, 0, 0]
	for i in range(n):
		if a[i] > t[1]:
			t = [i, a[i], 0, 0]
	for i in range(n):
		if b[i] + t[1] <= x:
			if b[i] > t[3]:
				t = [t[0], t[1], i, b[i]]
	if t[3] == 0:
		print('NO')
		return
	a.pop(t[0])
	b.pop(t[2])
	amax(a, b, n - 1, x)
for j in range(int(input())):
	(n, x) = map(int, input().split())
	a = aint()
	b = aint()
	amax(a, b, n, x)
	try:
		input()
	except EOFError:
		pass


t = int(input())
for k in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if k != t - 1:
		s = input()
	a.sort()
	b.sort()
	b = b[::-1]
	c = 0
	for i in range(n):
		if a[i] + b[i] <= x:
			c += 1
	if c == n:
		print('Yes')
	else:
		print('No')


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
T = int(input())
for t in range(T):
	if t:
		_ = input()
	n = list(map(int, input().split()))
	(n, lim) = (n[0], n[1])
	a1 = list(map(int, input().split()))
	a2 = list(map(int, input().split()))
	a1.sort()
	a2.sort(reverse=True)
	for (a, b) in zip(a1, a2):
		if a + b > lim:
			print('No')
			break
	else:
		print('Yes')


cases = int(input())
while cases > 0:
	(n, x) = input().split(' ')
	n = int(n)
	x = int(x)
	nums1 = input().split(' ')
	nums2 = input().split(' ')
	i = 0
	j = n - 1
	flag = 0
	while i < n and j > -1:
		if int(nums1[i]) + int(nums2[j]) > x:
			print('No')
			flag = 1
			break
		i += 1
		j -= 1
	if flag == 0:
		print('Yes')
	cases -= 1
	if cases != 0:
		input()


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List
sys.setrecursionlimit(99999)
t = int(input())
for cnt in range(t):
	(n, x) = map(int, input().split())
	arrA = list(map(int, input().split()))
	arrB = list(map(int, input().split()))
	arrA.sort()
	arrB.sort(reverse=True)
	if any((arrA[i] + arrB[i] > x for i in range(n))):
		print('NO')
	else:
		print('YES')
	if cnt < t - 1:
		input()


t = int(input())
answer = ''
for i in range(t):
	result = []
	(n, x) = map(int, input().split())
	a1 = list(map(int, input().split()))
	a2 = list(map(int, input().split()))
	a1.sort()
	a2.sort(reverse=True)
	if i != t - 1:
		input()
	for i in range(n):
		if a1[i] + a2[i] > x:
			result.append(1)
		else:
			result.append(0)
	if 1 in result:
		answer += 'No\n'
	else:
		answer += 'Yes\n'
print(answer[:len(answer) - 1])


boolean = False
for _ in range(int(input())):
	if boolean:
		input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')
	boolean = True


k = int(input())
for i in range(k):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	ac = sorted(a)
	bc = sorted(b, reverse=True)
	c = []
	for j in range(n):
		c.append(ac[j] + bc[j])
	if max(c) > x:
		print('NO')
	else:
		print('YES')
	if i < k - 1:
		l = input()


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort(reverse=True)
	b.sort()
	flag = False
	for i in range(n):
		if a[i] + b[i] > k:
			flag = True
			break
	if flag == True:
		print('No')
	else:
		print('Yes')
	if t != 0:
		s = input()


def poss(A, B, n, k):
	for i in range(n):
		if A[i] + B[n - 1 - i] > k:
			return False
	return True
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	if poss(A, B, n, x):
		print('Yes')
	else:
		print('No')
	if i != t - 1:
		_ = input()


import sys
input = sys.stdin.buffer.readline
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input().decode().rstrip('\n\r')
wrt = sys.stdout.write
pr = lambda *args, end='\n': wrt(' '.join([str(x) for x in args]) + end)
xrange = lambda args: reversed(range(args))
cdiv = lambda x, y: -(-x // y)
enum = enumerate
inf = float('inf')
mod = 10 ** 9 + 7
Cases = ri()
for Case in range(Cases):
	(n, x) = rl()
	a = rl()
	b = rl()
	a.sort()
	b.sort(reverse=True)
	for (i, j) in zip(a, b):
		if i + j > x:
			print('No')
			break
	else:
		print('Yes')
	rs()


notc = int(input())

def solve(x, a, b):
	for i in range(len(a) // 2 + 1):
		if a[i] + b[len(b) - i - 1] > x or b[i] + a[len(b) - i - 1] > x:
			print('NO')
			return
	print('YES')
for t in range(notc):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	try:
		input()
	except:
		pass
	solve(x, a, b)


ans = []
t = int(input())
for T in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if T != t - 1:
		blank = input().split()
	b.sort(reverse=True)
	flag = True
	for i in range(len(a)):
		if a[i] + b[i] > x:
			flag = False
			break
	if flag:
		ans.append('Yes')
	else:
		ans.append('No')
print(*ans, sep='\n')


t = int(input())
for j in range(t):
	(n, s) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))[::-1]
	if j != t - 1:
		z = input()
	ans = 'Yes'
	for i in range(n):
		if a[i] + b[i] > s:
			ans = 'No'
			break
	print(ans)


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


from sys import stdin, stdout

def INI():
	return int(stdin.readline())

def INL():
	return [int(_) for _ in stdin.readline().split()]

def INS():
	return stdin.readline()

def MOD():
	return pow(10, 9) + 7

def OPS(ans):
	stdout.write(str(ans) + '\n')

def OPL(ans):
	[stdout.write(str(_) + ' ') for _ in ans]
	stdout.write('\n')
t = int(input())
for _ in range(t - 1):
	(n, x) = INL()
	A = INL()
	B = INL()
	for _ in range(n):
		if A[_] + B[n - 1 - _] > x:
			OPS('No')
			break
	else:
		OPS('Yes')
	input()
(n, x) = INL()
A = INL()
B = INL()
for _ in range(n):
	if A[_] + B[n - 1 - _] > x:
		OPS('No')
		break
else:
	OPS('Yes')


t = int(input())
for i in range(t):
	(n, x) = list(map(int, input().split()))
	a = sorted(list(map(int, input().split())))
	b = list(reversed(sorted(list(map(int, input().split())))))
	print('Yes') if len(list(filter(lambda e: e <= x, [i + j for (i, j) in zip(a, b)]))) == len(a) else print('No')
	if i != t - 1:
		o = input()


t = int(input())
for q in range(t):
	ch = input()
	L = [int(i) for i in ch.split()]
	(n, x) = (L[0], L[1])
	ch = input()
	L1 = [int(i) for i in ch.split()]
	ch = input()
	L2 = [int(i) for i in ch.split()]
	I = L1.copy()
	J = L2.copy()
	I.sort()
	J.sort(reverse=True)
	T = []
	test = True
	for i in range(n):
		if I[i] + J[i] > x:
			test = False
	T.append(test)
	I.sort(reverse=True)
	J.sort()
	test = True
	for i in range(n):
		if I[i] + J[i] > x:
			test = False
	T.append(test)
	if T[0] or T[1]:
		print('YES')
	else:
		print('NO')
	if q < t - 1:
		w = input()


t = int(input())
for o in range(0, t, 1):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	for i in range(0, n, 1):
		if a[i] + b[i] > x:
			f = 0
			break
		else:
			f = 1
	if f == 1:
		print('Yes')
	else:
		print('No')
	if o != t - 1:
		c = input()
	else:
		break


def mySolver(a, b, n, x):
	a.sort()
	b.sort()
	ans = 'Yes'
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			ans = 'No'
			break
	return ans

def main():
	case = int(input())
	myAns = []
	limits_val = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	myAns.append(mySolver(a, b, limits_val[0], limits_val[1]))
	for i in range(1, case):
		empty_line = input()
		limits_val = list(map(int, input().split()))
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		myAns.append(mySolver(a, b, limits_val[0], limits_val[1]))
	for j in myAns:
		print(j)
main()


k = int(input())
for q in range(k):
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	if q != k - 1:
		input()
	for (i, j) in zip(A, B[::-1]):
		if i + j > x:
			print('No')
			break
	else:
		print('Yes')


time = int(input())
for t in range(time):
	if t > 0:
		f = str(input())
	(length, count) = map(int, input().split())
	first_array = list(map(int, input().split()))
	second_array = list(map(int, input().split()))
	summa_1 = 0
	summa_2 = 0
	for i in range(len(first_array)):
		if max(first_array) + min(second_array) <= count:
			second_array.remove(min(second_array))
			first_array.remove(max(first_array))
			summa_1 = summa_1 + 1
		else:
			print('no')
			summa_1 = -1
			break
	if summa_1 > 0:
		print('yes')


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	arr1.sort(reverse=True)
	arr2.sort()
	for i in range(n):
		if arr1[i] + arr2[i] > x:
			print('No')
			break
	else:
		print('Yes')
	if j < t - 1:
		input()


t = int(input())
ans = []
for x in range(t):
	inpt = input().split()
	input1 = list(map(int, input().split()))
	input2 = list(map(int, input().split()))
	input1.sort()
	input2.sort()
	ans.append('Yes')
	for i in range(0, int(inpt[0]) // 2 + 1):
		if input1[int(inpt[0]) - (i + 1)] + input2[i] > int(inpt[1]) or input2[int(inpt[0]) - (i + 1)] + input1[i] > int(inpt[1]):
			ans[x] = 'No'
			break
	if int(inpt[0]) == 1:
		if int(input1[0]) + int(input2[0]) > int(inpt[1]):
			ans[x] = 'No'
	if x < t - 1:
		input()
for i in ans:
	print(i, ' ')


t = int(input())
res = []
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	succ = 1
	if i < t - 1:
		c = input()
	if max(a) + min(b) > k or min(a) + max(b) > k:
		res.append('No')
		succ = 0
		continue
	a.sort()
	b.sort()
	b.reverse()
	for i in range(n):
		if a[i] + b[i] > k:
			res.append('No')
			succ = 0
			break
	if succ == 1:
		res.append('Yes')
for i in res:
	if i != res[-1]:
		print(i, end='\n')
	else:
		print(i)


from sys import stdin, stdout
input = stdin.readline
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	b = sorted(b)
	a = sorted(a)[::-1]
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')
	if _ != t - 1:
		x = input()


def help(n, x, a, b):
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			return 'No'
	return 'Yes'
t = int(input())
for ifr in range(t - 1):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print(help(n, x, a, b))
	c = input()
if True:
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print(help(n, x, a, b))


from sys import stdin
rl = stdin.readline

def main():
	t = int(rl())
	cases = []
	for i in range(t):
		case = (list(map(int, rl().split())), list(map(int, rl().split())), list(map(int, rl().split())))
		cases.append(case)
		if i < t - 1:
			rl()
	for ((n, x), a, b) in cases:

		def case_f():
			for i in range(n):
				if a[i] + b[n - 1 - i] > x:
					print('No')
					return
			print('Yes')
		case_f()
main()


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


for t in range(int(input()) * 2 - 1):
	try:
		(n, x) = map(int, input().split())
	except Exception:
		continue
	arr1 = [int(i) for i in input().split()]
	arr2 = [int(j) for j in input().split()]
	arr1.sort()
	arr2.sort(reverse=True)
	flag = True
	for _ in range(n):
		if arr1[_] + arr2[_] > x:
			flag = False
	if flag:
		print('Yes')
	else:
		print('No')


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

def inlt():
	return list(map(int, input().split()))
test_cases = inp()
for i in range(test_cases):
	if i != 0:
		input()
	(n, x) = inlt()
	a = inlt()
	b = inlt()
	a.sort()
	b.sort(reverse=True)
	ival = 0
	for j in range(n):
		if a[j] + b[j] > x:
			ival = 1
			break
	print('Yes' if ival == 0 else 'No')


for _ in range(int(input())):
	try:
		(n, x) = map(int, input().split())
	except ValueError as v:
		(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort(reverse=True)
	f = 0
	for i in range(n):
		if a[i] + b[i] > x:
			f = 1
			break
	if f == 1:
		print('No')
	else:
		print('Yes')


t = int(input())
for k in range(t):
	(n, x) = tuple(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	flag = True
	for i in range(n):
		if a[i] + b[-i - 1] > x:
			flag = False
			break
	if flag:
		print('Yes')
	else:
		print('No')
	if k != t - 1:
		input()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline()

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

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

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
for _ in range(N()):
	(n, x) = RL()
	(a, b) = (sorted(RLL()), sorted(RLL(), reverse=True))
	flag = True
	for i in range(n):
		if a[i] + b[i] > x:
			flag = False
			break
	print('Yes' if flag else 'No')
	input()


def findAns(a, b, x):
	a.sort()
	b.sort()
	b.reverse()
	for j in range(len(a)):
		if a[j] + b[j] > x:
			return 'No'
	return 'Yes'
t = int(input())
for i in range(t):
	arr = list(map(int, input().strip().split()))[:2]
	n = arr[0]
	x = arr[1]
	a = list(map(int, input().strip().split()))[:n]
	b = list(map(int, input().strip().split()))[:n]
	result = findAns(a, b, x)
	print(result)
	if i != t - 1:
		empty_null = input()


t = int(input())
ans = []
(n, x) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
q = True
a.sort()
b.sort()
b.reverse()
for j in range(0, n):
	if a[j] + b[j] > x:
		q = False
if q == True:
	ans.append('YES')
else:
	ans.append('NO')
for i in range(1, t):
	s = input()
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	q = True
	a.sort()
	b.sort()
	b.reverse()
	for j in range(0, n):
		if a[j] + b[j] > x:
			q = False
	if q == True:
		ans.append('YES')
	else:
		ans.append('NO')
for ans1 in ans:
	print(ans1)


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from heapq import heapify, heappop, heappush
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())), reverse=True)
	input()
	f = 1
	for i in range(n):
		if a[i] + b[i] > x:
			f = 0
			break
	if f:
		print('Yes')
	else:
		print('No')


import sys
from copy import *
from bisect import *
from math import gcd, ceil, sqrt
from itertools import permutations as prm, product

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def string(s):
	return ''.join(s)

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

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

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
while t > 0:
	t -= 1
	(n, k) = mi()
	a = li()
	b = li()
	a.sort()
	b.sort(reverse=True)
	c = []
	for i in range(n):
		c.append(a[i] + b[i])
	print('Yes' if max(c) <= k else 'No')
	if t:
		si()


for t in range(int(input())):
	if t > 0:
		temp = input()
	(n, x) = [int(x) for x in input().split()]
	a = sorted([int(x) for x in input().split()])
	b = sorted([int(x) for x in input().split()])[::-1]
	w = True
	for i in range(n):
		if a[i] + b[i] > x:
			w = False
			break
	if w:
		print('Yes')
	else:
		print('No')


a = int(input())
for i in range(a - 1):
	(b, c) = map(int, input().split())
	d = list(map(int, input().split()))
	e = list(map(int, input().split()))

	def abc(b):
		for j in range(b):
			if d[j] + e[-j - 1] > c:
				return 'No'
		return 'Yes'
	h = input()
	print(abc(b))
(b, c) = map(int, input().split())
d = list(map(int, input().split()))
e = list(map(int, input().split()))

def abc(b):
	for j in range(b):
		if d[j] + e[-j - 1] > c:
			return 'No'
	return 'Yes'
print(abc(b))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

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

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]

def YES():
	print('YES')

def NO():
	print('NO')

def Yes():
	print('Yes')

def No():
	print('No')
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24
from decimal import *
from math import *
from operator import or_
s = 0

def solve():
	(n, x) = sep()
	a = lis()
	b = lis()
	a.sort()
	b.sort(reverse=True)
	inp()
	for i in range(n):
		if a[i] + b[i] > x:
			No()
			return
	Yes()
testcase(int(inp()))


t = int(input())
for x in range(t):
	(inpt, input1, input2, ans) = (input().split(), sorted(map(int, input().split())), sorted(map(int, input().split()), reverse=True), 'Yes')
	for i in range(0, int(inpt[0])):
		if input1[i] + input2[i] > int(inpt[1]):
			ans = 'No'
			break
	if x < t - 1:
		input()
	print(ans)


t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	(n, x) = (a[0], a[1])
	b = sorted(list(map(int, input().split())))
	c = sorted(list(map(int, input().split())))[::-1]
	l = [b[i] + c[i] for i in range(n)]
	if all((i <= x for i in l)):
		print('Yes')
	else:
		print('No')
	if i < t - 1:
		input()


from itertools import product, combinations
from math import sqrt
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	ans = True
	for i in range(n):
		if a[i] + b[n - 1 - i] > x:
			ans = False
			break
	print('Yes' if ans else 'No')
	if _ < t - 1:
		s = input()


t = int(input())
for tc in range(t):
	(n, x) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l2.reverse()
	f1 = 0
	for i in range(n):
		if l1[i] + l2[i] > x:
			f1 = 1
			break
	if f1 == 0:
		print('Yes')
	else:
		print('No')
	if tc != t - 1:
		z = input()


t = int(input())
ans = []
while t != 0:
	c = list(map(int, input().split()))
	n = c[0]
	x = c[1]
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if t != 1:
		if input() == '':
			t = t - 1
	else:
		t = t - 1
	for i in range(n):
		if min(a) + max(b) > x:
			ans.append('No')
			break
		else:
			del a[a.index(min(a))]
			del b[b.index(max(b))]
	if len(a) == 0:
		ans.append('Yes')
for i in range(len(ans)):
	print(ans[i])


from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')
t = inp()
for _ in range(t):
	(n, x) = mp()
	l = li()
	f = 0
	k = li()
	if _ != t - 1:
		s = input()
	l.sort()
	k.sort(reverse=True)
	for i in range(n):
		p = l[i] + k[i]
		if p > x:
			f = 1
			break
	if f == 0:
		pr('Yes')
	else:
		pr('No')


for t in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort(reverse=True)
	flag = 1
	for i in range(n):
		if a[i] + b[i] > x:
			flag = 0
			break
	if flag == 0:
		print('No')
	else:
		print('Yes')
	try:
		x = input()
	except EOFError:
		pass


T = int(input())
for _ in range(0, T):
	(n, x) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	a.sort()
	b.sort()
	b = b[::-1]
	ans = 'Yes'
	for i in range(0, len(a)):
		if a[i] + b[i] > x:
			ans = 'No'
	print(ans)
	if _ != T - 1:
		br = input()


f = int(input())
for j in range(f):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	m = 0
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			m = 1
			break
	if m == 0:
		print('Yes')
	else:
		print('No')
	if j != f - 1:
		w = input()


t = int(input())
for i in range(t):
	(n, x) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	a.sort(reverse=False)
	b.sort(reverse=True)
	f = 0
	for i in range(n):
		if a[i] + b[i] > x:
			f = 1
			break
	if f == 1:
		print('No')
	else:
		print('Yes')
	try:
		temp = input()
	except:
		break


t = int(input())
for i in range(t):
	ans = 1
	if i > 0:
		line = input()
	(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())), reverse=True)
	for j in range(n):
		if a[j] + b[j] > x:
			ans = 0
			break
	if ans == 1:
		print('Yes')
	else:
		print('No')


T = int(input())
for case in range(T):
	if case != 0:
		input()
	(n, x) = [int(i) for i in input().split(' ')]
	a = [int(i) for i in input().split(' ')]
	b = [int(i) for i in input().split(' ')]
	a.sort()
	b.sort(reverse=True)
	for (i, j) in zip(a, b):
		if i + j > x:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
for _ in range(t):
	(a, x) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l1.sort()
	l2.sort(reverse=True)
	f = 1
	for i in range(a):
		if l1[i] + l2[i] > x:
			f = -1
			break
	if f == -1:
		print('No')
	else:
		print('Yes')
	if _ != t - 1:
		c = input()


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	for i in range(t):
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		s = str(input())
		sa = sorted(a)
		sb = sorted(b, reverse=True)
		cnt = 0
		for i in range(n):
			if sa[i] + sb[i] <= x:
				cnt += 1
		if cnt == n:
			print('Yes')
		else:
			print('No')
main()


t = int(input())
(aa, bb, xx) = ([], [], [])
for i in range(t):
	(n, x) = input().split()
	(n, x) = (int(n), int(x))
	ss = input().split()
	aa.append([int(s) for s in ss])
	ss = input().split()
	bb.append([int(s) for s in ss])
	xx.append(x)
	if i != t - 1:
		input()
for i in range(t):
	for (a, b) in zip(sorted(aa[i]), sorted(bb[i], reverse=True)):
		if a + b > xx[i]:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
while t:
	(n, x) = list(map(int, input().split()))
	a = sorted(map(int, input().split()))
	b = sorted(map(int, input().split()))
	b.reverse()
	flag = True
	for i in range(n):
		if a[i] + b[i] > x:
			flag = False
			break
	if flag:
		print('Yes')
	else:
		print('No')
	if t != 1:
		input()
	t -= 1


from sys import stdin, stdout
from os import path
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
f = int(stdin.readline())
for i in range(f):
	(x, y) = map(int, stdin.readline().strip().split())
	a = list(map(int, stdin.readline().strip().split()))
	b = list(map(int, stdin.readline().strip().split()))
	a.sort()
	b.sort()
	c = a
	q = b
	b = b[::-1]
	c = a[::-1]
	flag = flag2 = True
	for i in range(x):
		if a[i] + b[i] > y:
			flag = False
		if c[i] + q[i] > y:
			flag2 = False
	print('Yes' if flag == True or flag2 == True else 'No')
	y = stdin.readline()


import sys

def In():
	return sys.stdin.readline()

def Out(x):
	return sys.stdout.write(str(x) + '\n')
t = int(input())
for p in range(t):
	(n, x) = map(int, In().split())
	a = list(map(int, In().split()))
	b = list(map(int, In().split()))
	if p != t - 1:
		g = input()
	a.sort()
	b.sort(reverse=True)
	flag = True
	for i in range(n):
		if a[i] + b[i] > x:
			flag = False
			break
	if flag:
		Out('Yes')
	else:
		Out('No')


from sys import stdin
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

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

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

def main():
	t = inp()
	for _ in range(t):
		(n, x) = arrinp()
		A = sorted(arrinp())
		B = sorted(arrinp(), reverse=True)
		if _ != t - 1:
			garbage = input()
		flag = True
		for i in range(n):
			if A[i] + B[i] > x:
				flag = False
				break
		if flag:
			print('Yes')
		else:
			print('No')
main()


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	flag = True
	for i in range(n):
		if a[i] + b[i] > x:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')
	if _ != t - 1:
		input()


t = int(input())
while t:
	(n, x) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	b.reverse()
	bo = True
	for i in range(n):
		if a[i] + b[i] > x:
			bo = False
	if bo == True:
		print('Yes')
	else:
		print('No')
	if t != 1:
		zero = input()
	t -= 1


t = int(input())
for i in range(t):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if i < t - 1:
		s = input()
	a.sort()
	b.sort(reverse=True)
	flag = 0
	for j in range(n):
		if a[j] + b[j] > x:
			flag = 1
			print('No')
			break
	if flag == 0:
		print('Yes')


tc = int(input())
for _ in range(tc):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	res = 'Yes'
	for i in range(n):
		flag = 0
		for j in range(len(b)):
			if x >= a[i] + b[j]:
				b.remove(b[j])
				flag = 1
				break
		if flag == 0:
			res = 'No'
			break
	print(res)
	if _ != tc - 1:
		input()


import sys, io, os, time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
for ii in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	blank = input()
	b.sort(reverse=True)
	done = [False] * n
	for i in range(n):
		f = 0
		for j in range(n):
			if done[j]:
				continue
			if a[i] + b[j] <= x:
				done[j] = True
				f = 1
				break
		if not f:
			break
	if f:
		print('Yes')
	else:
		print('No')


t = int(input())
for f in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort(reverse=True)
	flag = False
	for i in range(n):
		if a[i] + b[i] > x:
			break
	else:
		print('Yes')
		if f != t - 1:
			eggs = input()
		continue
	print('No')
	if f != t - 1:
		eggs = input()


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	check = 0
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			check = 1
			break
	print(('Yes', 'No')[check])
	if j != t - 1:
		input()


import sys
t = int(input())
for tt in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	ans = True
	b1 = b[::-1]
	for i in range(n):
		if a[i] + b1[i] > x:
			ans = False
	if ans:
		print('Yes')
	else:
		print('No')
	if tt == t - 1:
		sys.exit()
	k1 = input()


import math
t = int(input())
for test in range(t):
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	B.sort(reverse=True)
	ans = []
	for i in A:
		v = x - i
		for j in range(n):
			if B[j] <= v and B[j] != 0:
				ans.append(B[j])
				B[j] = 0
				break
	if len(ans) == n:
		print('Yes')
	else:
		print('No')
	if test != t - 1:
		x = input()


val = int(input())
for _ in range(val):
	(n, x) = map(int, input().split(' '))
	first = list(map(int, input().split(' ')))
	second = list(map(int, input().split(' ')))
	first.sort()
	second.sort(reverse=True)
	flag = True
	for i in range(n):
		if first[i] + second[i] > x:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')
	if _ == val - 1:
		break
	else:
		input()


t = int(input())
while t:
	(size, k) = map(int, input().split())
	array1 = list(map(int, input().split()))
	array2 = list(map(int, input().split()))
	array2.reverse()
	val = 0
	flag = 0
	for i in range(len(array1)):
		val = array1[i] + array2[i]
		if val <= k:
			continue
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
	if t > 1:
		stri = input()
	t -= 1


t = int(input())
while t:
	t -= 1
	ans = 'Yes'
	try:
		(n, x) = map(int, input().split())
	except:
		(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	for i in range(n):
		if A[i] + B[n - i - 1] > x:
			ans = 'No'
			break
	print(ans)


def solve():
	(n, x) = [int(x) for x in input().strip().split()]
	arr = [int(x) for x in input().strip().split()]
	brr = [int(x) for x in input().strip().split()]
	try:
		_ = input()
	except EOFError:
		pass
	arr.sort()
	brr.sort(reverse=True)
	for i in range(n):
		if arr[i] + brr[i] > x:
			return 'no'
	return 'yes'
for _ in range(int(input().strip())):
	print(solve())


m = int(input())
for i in range(m):

	def cal(i):
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = sorted(map(int, input().split()))
		if i != m - 1:
			_ = input()
		temp = []
		for i in a:
			if i > x:
				return False
			temp.append(x - i)
		temp.sort()
		for i in range(n):
			if temp[i] < b[i]:
				return False
		return True
	if cal(i):
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t = t - 1
	(n, x) = input().split()
	n = int(n)
	x = int(x)
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	ans = True
	for i in range(n):
		if a[i] + b[i] > x:
			ans = False
			break
	if ans:
		print('Yes')
	else:
		print('No')
	if t > 0:
		g = input()


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = sorted(map(int, input().split()))
	b = sorted(map(int, input().split()), reverse=True)
	m = input() if i < t - 1 else 1
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')


p = lambda : map(int, input().split())
T = int(input())
for t in range(T):
	(N, X) = p()
	a = sorted(list(p()))
	b = sorted(list(p()))[::-1]
	w = 1
	for i in range(N):
		if a[i] + b[i] > X:
			w = 0
			break
	print('NYoe s'[w::2])
	if t != T - 1:
		input()


import sys
import time
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def bs(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve(n, x, a, b):
	a.sort()
	b.sort(reverse=True)
	for it in range(n):
		if a[it] + b[it] > x:
			print('NO')
			return
	print('YES')
	return
start_time = time.time()
t = iinp()
for i in range(t):
	(n, x) = mint()
	a = intl()
	b = intl()
	if i != t - 1:
		y = inp()
	solve(n, x, a, b)


count = 0
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	count += 1
	s = True
	if count != t:
		input()
	for i in range(n):
		if a[-1] + b[0] <= x:
			del a[-1]
			del b[0]
		else:
			print('No')
			s = False
			break
	if s:
		print('Yes')


T = int(input())
for _ in range(T):
	(n, x) = input().split()
	(n, x) = (int(n), int(x))
	a = input().split()
	b = input().split()
	a = [int(i) for i in a]
	b = [int(i) for i in b]
	a = sorted(a)
	b = sorted(b, reverse=True)
	for (i, j) in zip(a, b):
		if i + j > x:
			print('No')
			break
	else:
		print('Yes')
	if _ != T - 1:
		input()


answers = []
for i in range(int(input())):
	n = input()
	if n == '':
		n = int(input().split(' ')[1])
	else:
		n = int(n.split(' ')[1])
	a = sorted([int(x) for x in input().split(' ')], reverse=True)
	b = sorted([int(x) for x in input().split(' ')])
	answers.append(not any((a[x] + b[x] > n for x in range(len(a)))))
for answer in answers:
	if answer:
		print('Yes')
	else:
		print('No')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		(n, x) = list(map(int, input().split()))
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		if _ < t - 1:
			c = input()
		a.sort()
		b.sort(reverse=True)
		ans = True
		for i in range(n):
			if a[i] + b[i] > x:
				ans = False
				break
		if ans:
			yield 'YES'
		else:
			yield 'NO'
t = int(input())
ans = gift()
print(*ans, sep='\n')


t = int(input())
c = []
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.reverse()
	for v in a:
		for d in b:
			if v + d <= x:
				b.remove(d)
				break
	if bool(b) == False:
		c.append('YES')
	else:
		c.append('NO')
	if i != t - 1:
		u = input()
for i in c:
	print(i)


t = int(input())
li1 = []
i = 0
for _ in range(0, t):
	if i != 0:
		c = input()
	i = 1
	flag = 1
	(n, x) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l1.sort()
	l2.sort()
	l2.reverse()
	for y in range(len(l1)):
		if l1[y] + l2[y] > x:
			flag = 0
	li1.append(flag)
for item in li1:
	if item:
		print('Yes')
	else:
		print('No')


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	l1 = [int(x) for x in input().split()]
	l2 = [int(x) for x in input().split()]
	ok = 1
	for i in range(len(l1)):
		if l1[i] + l2[n - i - 1] <= x:
			continue
		else:
			print('No')
			ok = 0
			break
	if ok:
		print('Yes')
	if j < t - 1:
		s = input()


t = int(input())
while t > 0:
	(n, x) = map(int, input().split())
	l1 = [int(x) for x in input().split()]
	l2 = [int(x) for x in input().split()]
	if t > 1:
		s = input()
	l1.sort()
	l2.sort()
	l2 = l2[::-1]
	f = 0
	for i in range(n):
		if l1[i] + l2[i] > x:
			print('No')
			f = 1
			break
	if f == 0:
		print('Yes')
	t = t - 1


doit = int(input())
for _ in range(int(doit)):
	(n, x) = list(map(int, input().split()))
	my_list = list(map(int, input().split()))
	arr100 = list(map(int, input().split()))
	my_list.sort()
	flag = False
	arr100.sort(reverse=True)
	for k in range(n):
		if my_list[k] + arr100[k] > x:
			print('No')
			flag = True
			break
	if not flag:
		print('Yes')
	if _ != doit - 1:
		input()


import sys, os.path
from collections import *
from heapq import *
from copy import *
import math
mod = 10 ** 9 + 7
read = lambda : map(int, input().split())
inf = sys.maxsize
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = int(input())
for t1 in range(t):
	(n, x) = map(int, input().split())
	a = list(read())
	b = list(read())
	a.sort()
	b.sort(reverse=True)
	flag = 0
	for i in range(n):
		if a[i] + b[i] <= x:
			continue
		else:
			flag = 1
			break
	if flag == 1:
		print('No')
	else:
		print('Yes')
	if t1 != t - 1:
		s = input()


t = int(input())
while t > 0:
	t -= 1
	(n, x) = (int(_) for _ in input().strip().split(' '))
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	if t != 0:
		s = input()
	a.sort()
	b.sort(reverse=True)
	k = 1
	for i in range(0, n):
		if a[i] + b[i] > x:
			k = 0
			break
	if k:
		print('Yes')
	else:
		print('No')


T = int(input())
for t in range(T):
	(n, x) = list(map(int, input().split()))
	L1 = list(map(int, input().split()))
	L2 = list(map(int, input().split()))
	L1.sort()
	L2 = sorted(L2)[::-1]
	flag = 1
	for i in range(n):
		if L1[i] + L2[i] > x:
			flag = 0
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')
	if t < T - 1:
		input()


t = int(input())
while t > 0:
	t -= 1
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	a.reverse()
	b.sort()
	c = 0
	for i in range(0, n):
		if a[i] + b[i] > x:
			print('No')
			c = 1
			break
	if c == 0:
		print('Yes')
	if t > 0:
		input()


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	f = True
	for i in range(n):
		if a[i] + b[i] > x:
			f = False
	if f:
		print('YES')
	else:
		print('NO')
	if j != t - 1:
		input()


t = int(input())
while t > 0:
	l = input()
	n = int(l.split()[0])
	x = int(l.split()[1])
	a = []
	b = []
	l = input().split()
	for i in range(n):
		a.append(int(l[i]))
	l = input().split()
	for i in range(n):
		b.append(int(l[i]))
	a.sort()
	b.sort()
	flag = 0
	for i in range(n):
		if a[i] + b[n - 1 - i] > x:
			flag = 1
			break
	if flag:
		print('No')
	else:
		print('Yes')
	t = t - 1
	if t != 0:
		l = input()


from sys import stdout, stdin
from collections import defaultdict, deque
import math
t = int(stdin.readline())
for _ in range(t - 1):
	(n, m) = map(int, stdin.readline().split())
	l = list(map(int, stdin.readline().split()))
	ll = list(map(int, stdin.readline().split()))
	l.sort()
	ll.sort(reverse=True)
	ans = 'Yes'
	for i in range(n):
		if l[i] + ll[i] > m:
			ans = 'No'
			break
	print(ans)
	s = input()
(n, m) = map(int, stdin.readline().split())
l = list(map(int, stdin.readline().split()))
ll = list(map(int, stdin.readline().split()))
l.sort()
ll.sort(reverse=True)
ans = 'Yes'
for i in range(n):
	if l[i] + ll[i] > m:
		ans = 'No'
		break
print(ans)


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if _ != t - 1:
		s = input()
	a.sort()
	b.sort(reverse=True)
	ans = 'Yes'
	for z in range(n):
		if a[z] + b[z] > x:
			ans = 'No'
			break
	print(ans)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if i < t - 1:
		s = input()
	k = n - 1
	for j in range(n):
		if a[k] + b[j] > x:
			print('No')
			break
		k -= 1
	else:
		print('Yes')


from collections import Counter
from collections import OrderedDict
from collections import defaultdict
import bisect

def freq_count(mylist):
	return Counter(mylist)
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	arr = [int(x) for x in input().split()]
	arr1 = [int(x) for x in input().split()]
	if _ != t - 1:
		input()
	arr.sort()
	arr1.sort(reverse=True)
	for i in range(n):
		if arr[i] + arr1[i] <= x:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


import sys
import math
import collections
input = sys.stdin.readline
t = int(input())
for w in range(t):
	(n, x) = (int(i) for i in input().split())
	a = sorted([int(i) for i in input().split()], reverse=True)
	b = sorted([int(i) for i in input().split()])
	s = input()
	c = 1
	for i in range(n):
		if a[i] + b[i] > x:
			c = 0
			break
	if c == 1:
		print('Yes')
	else:
		print('No')


t = int(input())
for u in range(t):
	s = list(map(int, input().split()))
	n = s[0]
	x = s[1]
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if u < t - 1:
		input()
	a = sorted(a)
	b = sorted(b)
	c = 1
	b.reverse()
	for i in range(n):
		if a[i] + b[i] > x:
			c = 0
			break
	if c == 1:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
t = int(input())
for you in range(t):
	if you:
		l = input()
	l = input().split()
	n = int(l[0])
	x = int(l[1])
	l = input().split()
	a = [int(i) for i in l]
	l = input().split()
	b = [int(i) for i in l]
	done = [0 for i in range(n)]
	poss = 1
	for i in range(n):
		if a[i] > x:
			poss = 0
			break
		maxa = 0
		for j in range(n):
			if b[j] <= x - a[i] and b[j] > maxa and (done[j] == 0):
				maxa = b[j]
				ans = j
		if maxa == 0:
			poss = 0
			break
		done[ans] = 1
	if poss:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, x) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	if _ != t - 1:
		s = input()
	a.sort()
	b.sort(reverse=True)
	f = True
	for i in range(n):
		if a[i] + b[i] > x:
			f = False
			break
	if f == False:
		print('No')
	else:
		print('Yes')


t = int(input())
for p in range(t):
	(n, x) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	if p != t - 1:
		garb = input()
	a.sort()
	b.sort(reverse=True)
	flag = True
	for i in range(n):
		if a[i] + b[i] > x:
			flag = False
			break
	if not flag:
		print('No')
	else:
		print('Yes')


def solve(n, a, b, x):
	for i in range(n):
		if a[i] + b[i] > x:
			return 'No'
	return 'Yes'
t = int(input())
for i in range(t):
	(n, x) = list(map(int, input().split()))
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())), reverse=True)
	print(solve(n, a, b, x))
	if not i == t - 1:
		input()


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	if j != t - 1:
		input()
	arr1 = sorted(arr1)
	arr2 = sorted(arr2)
	arr2 = arr2[::-1]
	for i in range(n):
		if arr1[i] + arr2[i] > x:
			print('NO')
			break
		if i == n - 1 and arr1[i] + arr2[i] <= x:
			print('YES')
			break


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


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


tc = int(input())
for j in range(tc):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	z = True
	for i in range(n):
		if a[i] + b[i] > x:
			z = False
			break
	if z == True:
		print('Yes')
	else:
		print('No')
	if j < tc - 1:
		input()


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()

def test():
	t = list(map(int, input().split()))
	if t:
		(n, x) = (t[0], t[1])
	else:
		(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if all((i + j <= x for (i, j) in zip(a, reversed(b)))) and all((i + j <= x for (i, j) in zip(b, reversed(a)))):
		return 'Yes'
	else:
		return 'No'
t = int(input())
for _ in range(t):
	print(test())


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	if _ < t - 1:
		input()
	a = sorted(a)
	b = sorted(b)
	b = b[::-1]
	possible = True
	for i in range(n):
		if a[i] + b[i] > x:
			possible = False
	if possible:
		print('Yes')
	else:
		print('No')


n = int(input())
for i in range(n):
	a = [int(_) for _ in input().split()]
	b = sorted([int(_) for _ in input().split()])
	c = sorted([int(_) for _ in input().split()], reverse=True)
	if i != n - 1:
		d = input()
	flag = 1
	for j in range(a[0]):
		if b[j] + c[j] > a[1]:
			flag = 0
			break
	if flag == 1:
		print('Yes')
	else:
		print('No')


t = int(input())

def solve():
	(n, lim) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b = b[::-1]
	for i in range(n):
		if a[i] + b[i] > lim:
			print('No')
			return
	print('Yes')
	return
for i in range(t - 1):
	solve()
	s = input()
solve()


def solve(A, B, x, n):
	for (a, b) in zip(A, B[::-1]):
		if a + b > x:
			return 'No'
	return 'Yes'
for i in range(int(input())):
	if i > 0:
		input()
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	print(solve(A, B, x, n))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, b) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	x = input()
	l1.sort()
	l2.sort(reverse=True)
	f = 0
	for i in range(n):
		if l1[i] + l2[i] > b:
			f = 1
			break
	if f == 1:
		print('No')
	else:
		print('Yes')


import sys
import os

def changeStdioToFile():
	path = os.path.dirname(os.path.abspath(__file__))
	sys.stdin = open(f'{path}/input.txt', 'r')
	sys.stdout = open(f'{path}/output.txt', 'w')
t = 1
t = int(input())
for fuck in range(t):
	(n, k) = [int(x) for x in input().split()]
	a = sorted([int(x) for x in input().split()])
	b = sorted([int(x) for x in input().split()], reverse=True)
	res = sum((1 if sum(smol) <= k else 0 for smol in zip(a, b)))
	print('Yes' if res >= len(a) else 'No')
	if fuck < t - 1:
		input()


asdf = int(input())
for _ in range(asdf):
	(a, b) = map(int, input().split())
	z = list(map(int, input().split()))
	p = list(map(int, input().split()))
	z.sort()
	p.sort(reverse=True)
	stat = True
	for i in range(a):
		if z[i] + p[i] > b:
			stat = False
			break
	if stat == False:
		print('No')
	else:
		print('Yes')
	if _ != asdf - 1:
		input()


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for i in range(t):
	(n, x) = inm()
	a = sorted(inl())
	b = sorted(inl(), reverse=True)
	if i + 1 != t:
		ins()
	ans = True
	for i in range(n):
		if a[i] + b[i] > x:
			ans = False
			break
	print('Yes' if ans else 'No')


t = int(input())
for ti in range(t):
	if ti > 0:
		input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	ans = True
	for i in range(n):
		if a[i] + b[n - 1 - i] > x:
			ans = False
			break
	if ans:
		print('Yes')
	else:
		print('No')


from functools import reduce
import operator
t = int(input())
for each in range(t):
	(n, x) = list(map(int, input().split(' ')))
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	a.sort()
	b.sort(reverse=True)
	flag = True
	for i in range(len(a)):
		if a[i] + b[i] > x:
			flag = False
			print('No')
			break
	if flag:
		print('Yes')
	if each < t - 1:
		input()


for _ in range(int(input())):
	if _ != 0:
		jk = input()
	(n, x) = list(map(int, input().strip().split()))
	li1 = list(map(int, input().strip().split()))
	li2 = list(map(int, input().strip().split()))
	li1.sort()
	li2 = list(reversed(sorted(li2)))
	flag = 0
	for i in range(n):
		if li1[i] + li2[i] > x:
			print('No')
			flag = 1
			break
	if flag == 0:
		print('Yes')


def solve(x, a, b):
	for i in range(len(a)):
		if a[i] + b[len(b) - i - 1] > x:
			return 'No'
	return 'Yes'
t = int(input())
testcases = []
for k in range(t):
	(n, x) = input().split(' ')
	(n, x) = (int(n), int(x))
	a = [int(i) for i in input().split(' ')]
	b = [int(i) for i in input().split(' ')]
	testcases.append((x, a, b))
	if k < t - 1:
		input()
r = []
for c in testcases:
	r.append(solve(*c))
for v in r:
	print(v)


for xi in range(int(input())):
	if xi > 0:
		s = input()
	(n, k) = map(int, input().strip().split())
	l = list(map(int, input().strip().split()))
	l2 = list(map(int, input().strip().split()))
	l.sort()
	l2.sort(reverse=True)
	for i in range(n):
		if l[i] + l2[i] > k:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = sorted([int(x) for x in input().split()])
	b = sorted([int(x) for x in input().split()], reverse=True)
	print('NYoe s'[all((i + j <= x for (i, j) in zip(a, b)))::2])
	if i < t - 1:
		input()


T = int(input())
for i in range(T):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if i < T - 1:
		_ = input()
	a.sort()
	b.sort()
	b = b[::-1]
	flag = 0
	for (i, j) in zip(a, b):
		if i + j > x:
			flag = 1
			break
	if flag == 1:
		print('No')
	else:
		print('Yes')


t = int(input())
for item in range(t):
	(n, x) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	m = list(map(int, input().split()))[::-1]
	if item < t - 1:
		input()
		if all((m[itema] + l[itema] <= x for itema in range(n))):
			print('YES')
		else:
			print('NO')
	elif all((m[itema] + l[itema] <= x for itema in range(n))):
		print('YES')
	else:
		print('NO')


def solve(n, x, a, b):
	a.sort()
	b.sort(reverse=True)
	ans = 'Yes'
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 'No'
			break
	return ans
t = int(input())
while t:
	try:
		(n, x) = map(int, input().split())
	except:
		continue
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print(solve(n, x, a, b))
	t -= 1


xx = int(input())
for ii in range(xx):
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	B.sort(reverse=True)
	ans = []
	for i in A:
		v = x - i
		for j in range(n):
			if B[j] <= v and B[j] != 0:
				ans.append(B[j])
				B[j] = 0
				break
	if len(ans) == n:
		print('Yes')
	else:
		print('No')
	if ii != xx - 1:
		x = input()


import sys
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	if _ > 0:
		input()
	(n, k) = invr()
	a = inara()
	b = inara()
	a.sort()
	b.sort(reverse=True)
	flag = True
	for i in range(n):
		x = a[i] + b[i]
		flag &= x <= k
	if flag:
		print('Yes')
	else:
		print('No')


da = int(input())
for _ in range(da):
	(n, x) = map(int, input().split())
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	if _ != da - 1:
		input()
	b.reverse()
	flag = True
	for i in range(n):
		if a[i] + b[i] > x:
			flag = False
	print(['NO', 'YES'][flag])


import os
import sys
from io import BytesIO, IOBase
_str = str
BUFSIZE = 8192

def str(x=b''):
	return x if type(x) is bytes else _str(x).encode()

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

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

def mpint():
	return map(int, inp().split(' '))

def itg():
	return int(inp())
from collections import Counter, defaultdict

class SortedList:

	def __init__(self, iterable=None, _load=200):
		if iterable is None:
			iterable = []
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos], _list_lens[pos], _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __bool__(self):
		return self._len != 0

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

class SortedCounter:

	def __init__(self, data, discard=True):
		self.counter = Counter(data)
		self._discard = discard
		self._keys = SortedList(self.counter.keys())
		self._values = SortedList(self.counter.values())
		self.reversed_counter = defaultdict(set)
		for (key, value) in self.counter.items():
			self.reversed_counter[value].add(key)

	def __getitem__(self, item):
		return self.counter[item]

	def __setitem__(self, key, value):
		del self[key]
		if value <= 0 and self._discard:
			return
		self.counter[key] = value
		self._keys.add(key)
		self._values.add(value)
		self.reversed_counter[value].add(key)

	def __delitem__(self, key):
		if key in self.counter:
			v = self.counter[key]
			self._values.remove(v)
			self.reversed_counter[v].remove(key)
			if not self.reversed_counter[v] and self._discard:
				del self.reversed_counter[v]
			self._keys.remove(key)
			del self.counter[key]

	def add_value(self, key, value):
		if key in self.counter:
			value += self.counter[key]
		self[key] = value

	def most_common(self, k=None, remain_same_value=False):
		if k is None:
			k = len(self)
		if k <= 0 or not self:
			return []
		result = []
		for value in reversed(self._values):
			for key in self.reversed_counter[value]:
				result.append((key, value))
				k -= 1
				if k == 0 and (not remain_same_value):
					return result
			if k <= 0:
				return result
		raise ValueError('Oops! Bug!')

	def keys(self):
		return self._keys

	def values(self):
		return self._values

	def items(self):
		return ((key, self.counter[key]) for key in self._keys)

	def __len__(self):
		return len(self._keys)

	def __bool__(self):
		return len(self._keys) != 0

	def __contains__(self, item):
		return item in self.counter

	def __iter__(self):
		return iter(self._keys)

	def __repr__(self):
		return 'SortedDict({0})'.format(dict(self.counter))

class SortedSet(set):

	def __init__(self, data):
		data = set(data)
		self.elements = SortedList(data)
		super().__init__(data)

	def add(self, element) -> None:
		if not super().__contains__(element):
			self.elements.add(element)
			super().add(element)

	def remove(self, element) -> None:
		self.elements.remove(element)
		super().remove(element)

	def discard(self, element) -> None:
		self.elements.discard(element)
		super().discard(element)

	def __getitem__(self, item):
		return self.elements[item]

	def __iter__(self):
		return iter(self.elements)

	def __repr__(self):
		return 'SortedSet({0})'.format(list(self.elements))

def solve():
	(n, x) = mpint()
	aa = list(mpint())
	bb = list(mpint())
	s = SortedList(bb)
	for a in aa:
		i = s.bisect_right(x - a) - 1
		if i == -1:
			return False
		del s[i]
	return True

def main():
	for _ in range(itg()):
		print('Yes' if solve() else 'No')
		inp()
DEBUG = 0
URL = 'https://codeforces.com/contest/1445/problem/0'
if DEBUG == 1:
	import requests
	from ACgenerator.Y_Test_Case_Runner import TestCaseRunner
	runner = TestCaseRunner(main, URL)
	inp = runner.input_stream
	print = runner.output_stream
	runner.checking()
elif DEBUG == 2:
	main()
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	main()


n1 = int(input())
for p in range(n1):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b = b[::-1]
	if p != n1 - 1:
		z = input()
	for x in range(n):
		if a[x] + b[x] > k:
			print('NO')
			break
	else:
		print('YES')


test = int(input())
arr = []
(x, m) = map(int, input().split(' '))
arr1 = list(map(int, input().split(' ')))
arr2 = list(map(int, input().split(' ')))
arr1.sort()
arr2.sort(reverse=True)
for j in range(x):
	arr.append(arr1[j] + arr2[j])
if m >= max(arr):
	print('Yes')
else:
	print('No')
for i in range(test - 1):
	arr = []
	x = input()
	(x, m) = map(int, input().split(' '))
	arr1 = list(map(int, input().split(' ')))
	arr2 = list(map(int, input().split(' ')))
	arr1.sort()
	arr2.sort(reverse=True)
	for j in range(x):
		arr.append(arr1[j] + arr2[j])
	if m >= max(arr):
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	if _ != t - 1:
		space = input()
	b.reverse()
	f = 0
	for i in range(n):
		if a[i] + b[i] > x:
			f = 1
			break
	if f != 0:
		print('No')
	else:
		print('Yes')


c = int(input())
for t in range(c):
	(n, x) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	arr.sort()
	f = 0
	brr.sort(reverse=True)
	for i in range(n):
		if arr[i] + brr[i] <= x:
			pass
		else:
			f = 1
	if f == 1:
		print('No')
	else:
		print('Yes')
	if t < c - 1:
		input()


T = int(input())
for t1 in range(T):
	(n, x) = map(int, input().split())
	a = sorted(map(int, input().split()))
	b = sorted(map(int, input().split()), reverse=True)
	i = 0
	j = 0
	for i in range(n):
		if a[i] + b[i] > x:
			j = 1
			print('NO')
			break
	if j == 0:
		print('YES')
	if t1 < T - 1:
		k = input()


p = int(input())
for t in range(p):
	(n, x) = map(int, input().split(' '))
	a = [int(num) for num in input().split(' ')]
	b = [int(num) for num in input().split(' ')]
	if t != p - 1:
		c = input()
	ans = 'YES'
	for i in range(n):
		if a[i] + b[n - 1 - i] > x:
			ans = 'NO'
			break
	print(ans)


def main():
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	b.reverse()
	t = True
	for i in range(n):
		if a[i] + b[i] > x:
			t = False
			break
	if t:
		print('Yes')
	else:
		print('No')
	if wewq != rw - 1:
		input()
rw = int(input())
for wewq in range(rw):
	main()


import sys
from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
	(n, x) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	b = list(map(int, stdin.readline().split()))
	a.sort()
	b.sort()
	b.reverse()
	ans = 'Yes'
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 'No'
	print(ans)
	if loop != tt - 1:
		tmp = stdin.readline()


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if _ + 1 < t:
		s = input()
	for i in range(n):
		for j in range(n - 1, -1, -1):
			if a[i] + b[j] <= x and b[j] != -1:
				b[j] = -1
				break
	if n + sum(b) == 0:
		print('YES')
	else:
		print('NO')


def mojno(a, b):
	i = 0
	while i < n:
		if a[i] + b[-i - 1] <= x:
			i += 1
		else:
			qq = 1
			return 0
	return 1
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	qq = 0
	if mojno(a, b) == 1 or mojno(b, a) == 1:
		print('Yes')
	else:
		print('No')
	if _ < t - 1:
		s = str(input())


ns = lambda : input()
ni = lambda : int(input())
nm = lambda : map(int, input().split())
nl = lambda : list(map(int, input().split()))
q = ni()
for tc in range(q):
	(n, x) = nm()
	a = nl()
	b = nl()
	if tc != q - 1:
		ns()
	ans = 'Yes'
	for i in range(n):
		if a[i] + b[n - 1 - i] > x:
			ans = 'No'
			break
	print(ans)


t = int(input())
for k in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print('Yes' if all((a[i] + b[n - i - 1] <= x for i in range(n))) else 'No')
	if k != t - 1:
		empty_line = input()


t = int(input())
while t > 0:
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort(reverse=True)
	if t > 1:
		space = input()
	for (j, k) in zip(a, b):
		if j + k > x:
			print('No')
			break
	else:
		print('Yes')
	t -= 1


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 endline():
	return input()

def main():
	t = inp()
	while t > 0:
		t -= 1
		(n, x) = invr()
		a = inlt()
		b = inlt()
		a.sort()
		b.sort(reverse=True)
		ans = 'Yes'
		for i in range(0, n):
			if a[i] + b[i] > x:
				ans = 'No'
				break
		print(ans)
		input()
input = sys.stdin.readline
main()


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	ali = list(map(int, input().split()))
	bli = list(map(int, input().split()))
	q = sorted(ali)
	e = sorted(bli)
	w = sorted(ali, reverse=True)
	r = sorted(bli, reverse=True)
	f = 0
	for i in range(n):
		if q[i] + r[i] > x:
			f = 1
			break
	if f == 0:
		print('Yes')
	else:
		print('No')
	if j != t - 1:
		a = input()


p = int(input())
a = []
b = []
while p:
	inp = list(map(int, input().split()))
	n = inp[0]
	x = inp[1]
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	flag = True
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			flag = False
	if flag:
		print('Yes')
	else:
		print('No')
	p -= 1
	if p:
		input()


import sys
import heapq

class Solution:

	def process(self, n, x, a, b):
		for i in range(len(a)):
			m = 0
			for j in range(len(b) - 1, -1, -1):
				if a[i] + b[j] <= x:
					m = 1
					del b[j]
					break
			if not m:
				break
		print('No' if len(b) else 'Yes')

	def read_int(self, s):
		return int(s.strip())

	def read_int_arr(self, s):
		return [int(x) for x in s.strip().split(' ')]

	def parse(self, lines):
		n = self.read_int(lines[0])
		ind = 1
		for _ in range(n):
			(N, X) = self.read_int_arr(lines[ind])
			ind += 1
			a = self.read_int_arr(lines[ind])
			ind += 1
			b = self.read_int_arr(lines[ind])
			ind += 2
			self.process(N, X, a, b)

def main():
	Solution().parse(sys.stdin.readlines())
main()


t = int(input())

def abc(l, n, i, x):
	if i == n:
		return x
	return abc(l, n, i + 1, x) | abc(l, n, i + 1, x + l[i])
import random
for _ in range(t):
	(l, r) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	flag = 1
	for i in range(l):
		if a[i] + b[i] <= r:
			pass
		else:
			flag = 0
			break
	if flag:
		print('Yes')
	else:
		print('No')
	try:
		s = input()
	except:
		pass


def check(c, d, x):
	for i in range(len(a)):
		if c[i] + d[i] > x:
			return 'No'
	return 'Yes'
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = sorted(a)
	d = sorted(b)[::-1]
	print(check(c, d, x))
	try:
		s = input()
	except:
		pass


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


def main():
	t = int(input().split()[0])
	while t > 0:
		t -= 1
		(n, x) = tuple(map(int, input().split()))
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		a = sorted(a)
		b = sorted(b, key=lambda value: -value)
		flag = False
		for i in range(n):
			if a[i] + b[i] > x:
				print('No')
				flag = True
				break
		if not flag:
			print('Yes')
		if t > 0:
			input()
main()


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


import os
import sys
from io import BytesIO, IOBase
import math as M
import itertools as ITR
from collections import defaultdict as D
from collections import Counter as C
from collections import deque as Q
import threading
from functools import lru_cache, reduce
from functools import cmp_to_key as CMP
from bisect import bisect_left as BL
from bisect import bisect_right as BR
import random as R
import string
import cmath, time
enum = enumerate
start_time = time.time()
MOD = 1000000007
MA = float('inf')
MI = float('-inf')

def increase_stack():
	sys.setrecursionlimit(2 ** 32 // 2 - 1)
	threading.stack_size(1 << 27)
	t = threading.Thread(target=main)
	t.start()
	t.join()

def prints(a):
	print(a, end=' ')

def binary(n):
	return bin(n)[2:]

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def maxfactor(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
	if q:
		return q[-1]

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	l.sort()
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def seive(n):
	a = [1]
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for p in range(2, n + 1):
		if prime[p]:
			a.append(p)
	return a

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countchar(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def str_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def lis(arr):
	n = len(arr)
	lis = [1] * n
	maximum = 0
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
				maximum = max(maximum, lis[i])
	return maximum

def lcm(arr):
	a = arr[0]
	val = arr[0]
	for i in range(1, len(arr)):
		gcd = gcd(a, arr[i])
		a = arr[i]
		val *= arr[i]
	return val // gcd

def ncr(n, r):
	return M.factorial(n) // (M.factorial(n - r) * M.factorial(r))

def npr(n, r):
	return M.factorial(n) // M.factorial(n - r)

def inint():
	return int(inp())

def inarr():
	return list(map(int, inp().split()))

def invar():
	return map(int, inp().split())

def instr():
	s = inp()
	return list(s)

def insarr():
	return inp().split()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
inp = lambda : sys.stdin.readline().rstrip('\r\n')
TestCases = 1

def solve():
	(n, k) = invar()
	a = inarr()
	b = inarr()
	_ = inp()
	b = b[::-1]
	for i in range(n):
		if a[i] + b[i] > k:
			print('No')
			return
	print('Yes')

def main():
	flag = 0
	try:
		sys.stdin = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/input.txt', 'r')
		sys.stdout = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/output.txt', 'w')
	except:
		flag = 1
	t = 1
	if TestCases:
		t = inint()
	for _ in range(1, t + 1):
		solve()
	if not flag:
		print('Time: %.4f sec' % (time.time() - start_time))
		localtime = time.asctime(time.localtime(time.time()))
		print(localtime)
		sys.stdout.close()
main()


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


T = int(input())
for t in range(T):
	if t:
		blank = input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort(reverse=True)
	good = 1
	for i in range(n):
		if a[i] + b[i] > x:
			good = 0
	print('Yes') if good else print('No')


def solve():
	arr = [int(x) for x in input().split()]
	n = arr[0]
	x = arr[1]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	a.sort()
	b.sort(reverse=True)
	for i in range(0, n):
		if a[i] + b[i] > x:
			print('No')
			return
	print('Yes')
t = int(input())
for i in range(0, t):
	solve()
	if i != t - 1:
		a = input()


import sys
tests = int(sys.stdin.readline())
for _ in range(tests):
	(n, x) = list(map(int, sys.stdin.readline().split()))
	a = list(map(int, sys.stdin.readline().split()))
	b = list(map(int, sys.stdin.readline().split()))
	s = [i[0] + i[1] for i in zip(sorted(a), reversed(sorted(b)))]
	_ = sys.stdin.readline()
	for y in s:
		if y > x:
			print('No')
			break
	else:
		print('Yes')


from sys import stdin
input = stdin.readline
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	b = b[::-1]
	flag = False
	for i in range(n):
		if a[i] + b[i] > x:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')
	s = input()


n = int(input())
for i in range(n):
	(num, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	k = 0
	for j in range(num):
		if a[j] + b[j] > x:
			k = 1
			break
	if k == 1:
		print('No')
	else:
		print('Yes')
	if i != n - 1:
		input()


for j in range(int(input())):
	if j != 0:
		null = input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	flag = True
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			flag = False
			print('No')
			break
	if flag:
		print('Yes')


import os
import sys
import math
import collections
import itertools

def get_int():
	return int(input())

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

def get_strs():
	return input().split()

def get_float():
	return float(input())

def get_floats():
	return map(float, input().split())

def list_strs():
	return list(input().split())

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

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

def post(x):
	print(x, end=' ')
T = int(input())
for t in range(1, T + 1):
	(n, x) = get_ints()
	a = sorted(list_ints())
	b = sorted(list_ints(), reverse=True)
	res = 'Yes'
	for i in range(len(a)):
		if a[i] + b[i] > x:
			res = 'No'
	print(res)
	if t <= T - 1:
		y = input()


from math import *
import threading
import sys
mod = 10 ** 9 + 7

def npr(n, r):
	return factorial(n) // factorial(n - r) if n >= r else 0

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = -1
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = mid
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	li = []
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, len(prime)):
		if prime[p]:
			li.append(p)
	return li
sys.setrecursionlimit(300000)
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if _ != t - 1:
		s = input()
	a.sort()
	b.sort(reverse=True)
	f = 1
	for i in range(n):
		if a[i] + b[i] > x:
			f = 0
			break
	if f:
		print('Yes')
	else:
		print('No')


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

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

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

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * (2 * 10 ** 5 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(2 * 10 ** 5 + 5):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj
mod = 10 ** 9 + 7

def solve(k, t):
	(n, x) = IP()
	a = L()
	b = L()
	if a[-1] + b[-1] <= x:
		print('YES')
		if k != t - 1:
			nl = input()
		return
	else:
		b = b[::-1]
		for i in range(n):
			if a[i] + b[i] > x:
				print('NO')
				if k != t - 1:
					nl = input()
				return
		print('YES')
		if k != t - 1:
			nl = input()
		return
	return
t = II()
for i in range(t):
	solve(i, t)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	(N, X) = getInts()
	A = getInts()
	B = getInts()
	B.reverse()
	for i in range(len(A)):
		if A[i] + B[i] > X:
			return 'No'
	return 'Yes'
for _ in range(getInt()):
	if _ > 0:
		input()
	print(solve())


t = int(input())
for i in range(t):
	(n, x) = [int(x) for x in input().split(' ')]
	a = [int(x) for x in input().split(' ')]
	b = [int(x) for x in input().split(' ')]
	passed = True
	for (j, c) in enumerate(b[::-1]):
		if c + a[j] > x:
			passed = False
			break
	print({True: 'Yes', False: 'No'}[passed])
	if i < t - 1:
		input()


t = int(input())
while t > 0:
	(n, x) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	a.sort()
	b.sort()
	b.reverse()
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')
	if t != 1:
		s = input()
	t = t - 1


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b = b[::-1]
	mx = 0
	for i in range(n):
		mx = max(mx, a[i] + b[i])
	if mx > x:
		print('NO')
	else:
		print('YES')
	if _ != t - 1:
		l = input()


t = int(input())
ans = []
for k in range(t):
	(n, x) = map(int, input().split())
	li1 = list(map(int, input().split()))
	li2 = list(map(int, input().split()))
	i = 0
	j = n - 1
	flag = 1
	while i < n and j >= 0:
		if li1[i] + li2[j] <= x:
			i += 1
			j -= 1
		else:
			ans.append('No')
			flag = 0
			break
	if flag:
		ans.append('Yes')
	if k < t - 1:
		z = input()
for i in ans:
	print(i)


from sys import stdin
t = int(stdin.readline())
for test in range(t):
	(n, x) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	b = list(map(int, stdin.readline().split()))
	a.sort()
	b.sort(reverse=True)
	f = True
	for i in range(n):
		if a[i] + b[i] > x:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')
	if test != t - 1:
		space = stdin.readline()


def checkNonDescending(a, x):
	for i in range(len(a) - 1):
		if a[i] > a[i + 1]:
			return 0
		if a[i] > x | a[i + 1] > x:
			return 1
	return 2

def checkPermutability(a, b, x):
	b_sort = b.sort(reverse=True)
	for i in range(len(a)):
		if a[i] + b[i] > x:
			return 'No'
	return 'Yes'
nbTestcase = int(input())
listParams = []
listArrayA = []
listArrayB = []
for i in range(nbTestcase):
	params = list(map(int, input().split(' ')))
	listParams.append(params)
	mSize = params[0]
	threshold = params[1]
	arrayA = list(map(int, input().split(' ')))
	arrayB = list(map(int, input().split(' ')))
	listArrayA.append(arrayA)
	listArrayB.append(arrayB)
	if i < nbTestcase - 1:
		input()
for i in range(nbTestcase):
	params = listParams[i]
	mSize = params[0]
	threshold = params[1]
	arrayA = listArrayA[i]
	arrayB = listArrayB[i]
	res = checkPermutability(arrayA, arrayB, threshold)
	print(res)


f = int(input())
for j in range(f):
	(n, x) = map(int, input().split())
	massiv1 = sorted(list(map(int, input().split())))
	massiv2 = sorted(list(map(int, input().split())), reverse=True)
	if j + 1 != f:
		fuckup = input()
	isTrue = True
	for i in range(n):
		if massiv1[i] + massiv2[i] > x:
			isTrue = False
			break
	print('Yes' if isTrue else 'No')


import sys
import itertools as it
import math as mt
import bisect as bi
import collections as cc
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(n, x) = I()
	a = I()
	b = I()
	a.sort()
	b.sort(reverse=True)
	tf = 1
	for i in range(n):
		if a[i] + b[i] > x:
			tf = 0
	if tf:
		print('Yes')
	else:
		print('No')
	try:
		input()
	except:
		pass


import sys
from array import array
from typing import List, Tuple, TypeVar, Generic, Sequence, Union

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def main():
	t = int(input())
	for _ in range(t):
		(n, x) = map(int, input().split())
		a = sorted(map(int, input().split()))
		b = sorted(map(int, input().split()), reverse=True)
		if all((a[i] + b[i] <= x for i in range(n))):
			print('Yes')
		else:
			print('No')
		if _ < t - 1:
			input()
main()


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('NO')
			break
	else:
		print('YES')
	try:
		s = input()
	except:
		pass


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))[::-1]
	for i in range(n):
		res = 'Yes'
		if a[i] + b[i] > x:
			res = 'No'
			break
	print(res)
	if j != t - 1:
		p = input()


_39 = '1445b'
_40 = '1445a'
t = int(input())
flag = False
k = []
count = 0
r = 0
for i in range(t):
	if i != t and i != 0:
		l = input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] <= x:
			count += 1
	if count == n:
		k.append('Yes')
	else:
		k.append('No')
	count = 0
for i in k:
	print(i)


t = int(input())

def solve():
	[n, x] = list(map(int, input().strip().split()))[:2]
	a = list(map(int, input().strip().split()))[:n]
	b = list(map(int, input().strip().split()))[:n]
	a = sorted(a)
	b = sorted(b)
	b = list(reversed(b))
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			return
	print('Yes')
	return
for p in range(t):
	solve()
	if p < t - 1:
		inp = input()


def str_list_to_int(a):
	list_of_integers = list(map(int, a))
	return list_of_integers

def reorder(li, n, x):
	count = 0
	for i in range(n):
		if li[0][i] + li[1][i] <= x:
			count += 1
		else:
			return 'No'
	if count == n:
		return 'Yes'
	return 'No'
t = int(input())
answers = []
for i in range(t):
	if i != 0:
		s = input()
	(n, x) = input().split()
	list_of_str = []
	list_of_integers = []
	for i in range(2):
		list_of_str.append(input().split())
		list_of_integers.append(str_list_to_int(list_of_str[i]))
	list_of_integers[0].sort()
	list_of_integers[1].sort(reverse=True)
	answers.append(reorder(list_of_integers, int(n), int(x)))
for i in answers:
	print(i)


t = int(input())
while t > 0:
	t -= 1
	(n, tar) = map(int, input().split())
	l = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	if t > 0:
		space = input()
	l2 = l2[::-1]
	flag = 1
	for i in range(n):
		if l[i] + l2[i] > tar:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


def solve(a, b, n, x):
	for i in range(n):
		if a[i] + b[i] > x:
			return 'No'
	return 'Yes'
for _ in range(int(input())):
	if _ > 0:
		end_of_line = input()
	(n, x) = map(int, input().strip().split())
	a = list(map(int, input().strip().split()))
	b = list(map(int, input().strip().split()))
	a.sort()
	b.sort(reverse=True)
	print(solve(a, b, n, x))


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for _ in range(t):
	(n, x) = I()
	a = sorted(I())
	b = sorted(I())[::-1]
	an = 'Yes'
	for i in range(n):
		if a[i] + b[i] > x:
			an = 'No'
			break
	print(an)
	I()


t = int(input())
for u in range(t):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if u < t - 1:
		o = input()
	b = b[::-1]
	f = 0
	for i in range(n):
		if a[i] + b[i] > x:
			f = 1
			break
	if f:
		print('No')
	else:
		print('Yes')


T = int(input())
for t1 in range(T):
	(n, x) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	i = 0
	j = 0
	while i < n:
		a1 = max(a)
		b1 = min(b)
		a.remove(a1)
		b.remove(b1)
		i += 1
		if a1 + b1 > x:
			j = 1
			print('NO')
			break
	if j == 0:
		print('YES')
	if t1 < T - 1:
		k = input()


t = int(input())
for i in range(t):
	(n, x) = (int(c) for c in input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	for (p, q) in zip(a, reversed(b)):
		if p + q > x:
			print('No')
			break
	else:
		print('Yes')
	if i < t - 1:
		input()


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if i != n - 1:
		s = input()
	if sum(a) + sum(b) > x * y:
		print('No')
	else:
		a.sort()
		b.sort(reverse=True)
		for i in range(x):
			if a[i] + b[i] > y:
				print('No')
				break
		else:
			print('Yes')


for u in range(int(input())):
	if u >= 1:
		s = input()
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	d = list(map(int, input().split()))
	l.sort()
	d.sort(reverse=True)
	f = 0
	for i in range(n):
		if l[i] + d[i] > k:
			f = 1
			break
	if f == 0:
		print('Yes')
	else:
		print('No')


test = int(input())
for i in range(test):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b = b[::-1]
	if sum(a) + sum(b) > n * x:
		print('No')
	else:
		flag = True
		for p in range(n):
			if a[p] + b[p] > x:
				flag = False
				break
		if flag:
			print('Yes')
		else:
			print('No')
	if i != test - 1:
		space = input()


n = int(input())
L = []
for i in range(n):
	L.append([])
for i in range(n):
	a = [int(j) for j in input().split()]
	if a != []:
		L[i].append(a)
		L[i].append([int(j) for j in input().split()])
		L[i].append([int(j) for j in input().split()])
	else:
		L[i].append([int(j) for j in input().split()])
		L[i].append([int(j) for j in input().split()])
		L[i].append([int(j) for j in input().split()])
for i in L:
	x = i[0][1]
	while i[1] != [] and i[2] != []:
		if min(i[1]) + max(i[2]) > x:
			print('No')
			break
		else:
			i[1].remove(min(i[1]))
			i[2].remove(max(i[2]))
	if i[1] == [] and i[2] == []:
		print('Yes')


T = int(input())
for case in range(T):
	(n, x) = map(int, input().split())
	a = map(int, input().split())
	b = list(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		val = next(a) + b[i]
		if val > x:
			print('No')
			break
	else:
		print('Yes')
	try:
		input()
	except EOFError:
		break


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
from itertools import permutations, combinations

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
sys.setrecursionlimit(100000)
INF = float('inf')
mod = 998244353
for t in range(int(data())):
	if t:
		s = data()
	(n, x) = mdata()
	a = sorted(mdata())
	b = sorted(mdata())[::-1]
	flag = 1
	for i in range(n):
		if a[i] + b[i] > x:
			flag = 0
			break
	if flag:
		out('Yes')
	else:
		out('No')


tc = int(input())
tc += tc - 1
for _ in range(tc):
	try:
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		a.sort(reverse=True)
		b.sort(reverse=True)
		(i, j, flag) = (0, 0, 0)
		while True:
			try:
				if j == n:
					break
				elif a[i] + b[j] <= x:
					a.pop(i)
					b.pop(j)
					(i, j) = (0, 0)
				elif len(a) == 0 and len(b) == 0:
					flag = 1
					break
				else:
					j += 1
			except IndexError:
				if len(a) == 0 and len(b) == 0:
					flag = 1
				break
		if flag:
			print('Yes')
		else:
			print('No')
	except ValueError:
		continue


tests = int(input())
for t in range(tests):
	(n, x) = [int(x) for x in input().split(' ')]
	a = [int(x) for x in input().split(' ')]
	b = [int(x) for x in input().split(' ')]
	if t != tests - 1:
		c = input()
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = sorted([*map(int, input().split())])
	b = sorted([*map(int, input().split())])[::-1]
	print('YNeos'[any([ai + bi > x for (ai, bi) in zip(a, b)]) == True::2])
	if _ != t - 1:
		input()


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()

def main():
	for _ in range(int(I1())):
		(N, X) = I()
		arr = list(I())
		brr = list(I())
		flag = 0
		for i in range(N):
			if arr[i] + brr[N - i - 1] > X:
				flag = 1
				break
		if flag == 1:
			print('NO')
		else:
			print('YES')
		s = I1()
main()


import sys
test = int(input())
for _ in range(test):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	answer = [i for i in range(n) if a[i] + b[n - i - 1] > x]
	if len(answer) > 0:
		print('No')
	else:
		print('Yes')
	if _ == test - 1:
		sys.exit(0)
	x = input()


t = int(input())
for l in range(t):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	arr.sort()
	arr2.sort(reverse=True)
	possible = True
	for i in range(n):
		if arr[i] + arr2[i] > x:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')
	if l < t - 1:
		input()


try:
	for t in range(int(input())):
		if t != 0:
			q = input()
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		b.reverse()
		c = 0
		for j in range(0, n):
			if a[j] + b[j] <= x:
				c = 0
			else:
				c = 1
				break
		if c == 0:
			print('YES')
		else:
			print('NO')
except EOFError as e:
	pass


t = int(input())
z = 0
for i in range(t):
	z += 1
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if z < t:
		c = input()
	a.sort()
	b.sort(reverse=True)
	ans = 'Yes'
	for j in range(n):
		if a[j] + b[j] > x:
			ans = 'No'
			break
	print(ans)


def main(x, a, b):
	a.sort(reverse=True)
	b.sort()
	for (ai, bi) in zip(a, b):
		if ai + bi > x:
			return 'No'
	return 'Yes'
T = int(input())
for case in range(T):
	(_, x) = [int(i) for i in input().split(' ')]
	a = [int(i) for i in input().split(' ')]
	b = [int(i) for i in input().split(' ')]
	try:
		input()
	except EOFError:
		pass
	print('{}'.format(main(x, a, b)))


t = int(input())
for ll in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if ll != t - 1:
		d = input()
	b = sorted(b, reverse=True)
	f = 1
	for i in range(n):
		if a[i] + b[i] > k:
			f = 0
			break
	print('Yes' if f == 1 else 'No')


from sys import stdin
input = lambda : stdin.readline().strip()
t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.reverse()
	f = 1
	for i in range(n):
		if a[i] + b[i] > x:
			f = 0
	if f:
		print('Yes')
	else:
		print('No')
	if j != t - 1:
		input()


from sys import maxsize, stdout, stdin, stderr
import re
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
S = lambda : stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
stpr = lambda x: stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
t = I()
for _ in range(t):
	(n, x) = tup()
	l1 = lint()
	l2 = lint()
	l2.sort(reverse=True)
	f = 1
	for i in range(n):
		if l1[i] + l2[i] <= x:
			pass
		else:
			f = 0
			break
	if f == 1:
		print('Yes')
	else:
		print('No')
	if _ != t - 1:
		S()


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

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

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()

def ok():
	for (a, b) in zip(aa, bb):
		if a + b > x:
			return False
	return True
for t in range(II()):
	if t:
		BI()
	(n, x) = MI()
	aa = LI()
	bb = LI()
	aa.sort()
	bb.sort(reverse=True)
	if ok():
		print('Yes')
	else:
		print('No')


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

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

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

def N():
	return int(input())
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa = ifa[::-1]

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def binfun(x):
	c = 0
	for w in arr:
		c += ceil(w / x)
	return c

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class smt:

	def __init__(self, l, r, arr):
		self.l = l
		self.r = r
		self.value = (1 << 31) - 1 if l < r else arr[l]
		mid = (l + r) // 2
		if l < r:
			self.left = smt(l, mid, arr)
			self.right = smt(mid + 1, r, arr)
			self.value &= self.left.value & self.right.value

	def setvalue(self, x, val):
		if self.l == self.r:
			self.value = val
			return
		mid = (self.l + self.r) // 2
		if x <= mid:
			self.left.setvalue(x, val)
		else:
			self.right.setvalue(x, val)
		self.value = self.left.value & self.right.value

	def ask(self, l, r):
		if l <= self.l and r >= self.r:
			return self.value
		val = (1 << 31) - 1
		mid = (self.l + self.r) // 2
		if l <= mid:
			val &= self.left.ask(l, r)
		if r > mid:
			val &= self.right.ask(l, r)
		return val

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] < self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d

def GP(it):
	res = []
	for (ch, g) in groupby(it):
		res.append((ch, len(list(g))))
	return res
t = N()
for i in range(t):
	(n, x) = RL()
	a = RLL()
	b = RLL()
	if i != t - 1:
		tmp = input()
	a.sort()
	b.sort(reverse=True)
	ans = 'YES' if all((a[i] + b[i] <= x for i in range(n))) else 'NO'
	print(ans)


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	(n, x) = map(int, sys.stdin.readline().split())
	list_a = list(map(int, sys.stdin.readline().split()))
	list_b = list(map(int, sys.stdin.readline().split()))
	sys.stdin.readline()
	list_a.sort()
	list_b.sort(reverse=True)
	res = 'YES'
	for i in range(n):
		if list_a[i] + list_b[i] > x:
			res = 'NO'
			break
	print(res)


import sys
import math
input = sys.stdin.readline

def get_int():
	return int(input().strip())

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

def get_char_list():
	return list(input().strip())
cases = get_int()
for _ in range(cases):
	(n, m) = get_int_list()
	a = get_int_list()
	b = get_int_list()
	input()
	a.sort()
	b.sort(reverse=True)
	bad = False
	for i in range(n):
		if a[i] + b[i] > m:
			bad = True
			break
	if bad:
		print('NO')
	else:
		print('YES')


nums = int(input())

def func(n, x):
	bool = True
	a_list = [int(y) for y in input().split()]
	b_list = [int(z) for z in input().split()]
	a_list.sort(reverse=True)
	b_list.sort()
	i = 0
	for i in range(n):
		if a_list[i] + b_list[i] > x:
			bool = False
	if bool == True:
		return 'Yes'
	else:
		return 'No'
for j in range(nums):
	var = [int(a) for a in input().split()]
	print(func(var[0], var[1]))
	if j != nums - 1:
		input()


t = int(input())
count = 0
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	flag = 1
	b.reverse()
	c = [a[i] + b[i] for i in range(n)]
	for i in c:
		if i > x:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')
	count += 1
	if count == t:
		break
	input()


import math
import sys, bisect
from heapq import *
from itertools import *
from collections import *
sys.setrecursionlimit(10 ** 6)
I = lambda : int(sys.stdin.readline())
neo = lambda : map(int, sys.stdin.readline().split())
Neo = lambda : list(map(int, sys.stdin.readline().split()))
for _ in range(I()):
	(n, x) = neo()
	A = Neo()
	B = Neo()
	C = Neo()
	A.sort()
	f = 0
	B.sort(reverse=True)
	for (i, j) in zip(A, B):
		if i + j > x:
			print('No')
			f = 1
			break
	if f == 0:
		print('Yes')


loops = input()
for i in range(int(loops)):
	l1 = input()
	l2 = input()
	l3 = input()
	l1 = l1.split(' ')
	array_size = int(l1[0])
	par = int(l1[1])
	arr1 = l2.split(' ')
	int_ar1 = [int(l) for l in arr1]
	arr2 = l3.split(' ')
	int_ar2 = [int(l) for l in arr2]
	int_ar2.sort(reverse=True)
	arr3 = [a + b for (a, b) in zip(int_ar1, int_ar2)]
	for j in range(array_size):
		if arr3[j] <= par:
			if j == array_size - 1:
				print('Yes')
		else:
			print('No')
			break
	if i != int(loops) - 1:
		space = input()


import math

def solve(a, b, x):
	a = sorted(a, reverse=True)
	b = sorted([b_i - x for b_i in b])
	for (a_i, b_i) in zip(a, b):
		if a_i + b_i > 0:
			return 'No'
	return 'Yes'
t = int(input())
a = []
b = []
for _ in range(t):
	(n, x) = tuple(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print(solve(a, b, x))
	try:
		input()
	except EOFError:
		pass


test = int(input())
for t in range(test):
	nx = [int(num) for num in input().split()]
	n = nx[0]
	x = nx[1]
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	if t != test - 1:
		blank = input()
	b.reverse()
	check = True
	for i in range(n):
		if a[i] + b[i] > x:
			check = False
	print('Yes' if check else 'No')


import os
import sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		blank = input()
		a.sort()
		b.sort(reverse=True)
		for i in range(n):
			if a[i] + b[i] > x:
				print('NO')
				break
		else:
			print('YES')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


y = int(input())
for _ in range(y):
	q = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))[::-1]
	e = True
	for i in range(q[0]):
		if a[i] + b[i] <= q[1]:
			pass
		else:
			print('No')
			e = False
			break
	if e:
		print('Yes')
	if _ < y - 1:
		input()


import math
t = int(input())
while t > 0:
	t -= 1
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if t != 0:
		input()
	a.sort()
	b.sort(reverse=True)
	fg = 0
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			fg = 1
			break
	if fg == 0:
		print('Yes')


for k in range(int(input())):
	tmp = input().split()
	if len(tmp) != 2:
		(n, x) = input().split()
	else:
		(n, x) = tmp
	(n, x) = (int(n), int(x))
	a = input().split()
	b = input().split()
	s = []
	for i in range(len(a)):
		if int(a[i]) + int(b[-1 - i]) <= x:
			s.append(0)
		else:
			s.append(1)
	if 1 in s:
		print('No')
	else:
		print('Yes')


import bisect
import math

def solve(n, x, arr1, arr2):
	p = 10 ** 9 + 7
	arr1.sort()
	arr2.sort(reverse=True)
	for j in range(n):
		if arr1[j] + arr2[j] <= x:
			continue
		else:
			return 'No'
	return 'Yes'
	pass
t = int(input())
ans = []
for i in range(t):
	arr = [int(x) for x in input().split()]
	n = arr[0]
	x = arr[1]
	arr1 = [int(x) for x in input().split()]
	arr2 = [int(x) for x in input().split()]
	ans.append(solve(n, x, arr1, arr2))
	if i != t - 1:
		s = input()
for test in ans:
	print(test)


t = int(input())
for T in range(t):
	(n, x) = map(int, input().split())
	lis1 = list(map(int, input().split()))
	lis2 = list(map(int, input().split()))
	lis2 = sorted(lis2, reverse=True)
	for (i, j) in zip(lis1, lis2):
		if i + j > x:
			print('No')
			if T != t - 1:
				input()
			break
	else:
		print('Yes')
		if T != t - 1:
			input()


t = int(input())
while t:
	t += -1
	(n, x) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l1.sort()
	l2.sort(reverse=True)
	check = 1
	for i in range(n):
		if l1[i] + l2[i] > x:
			check = 0
			break
	if check:
		print('Yes')
	else:
		print('No')
	if t != 0:
		input()


w = int(input())
for i in range(w):
	t = list(map(int, input().split()))
	x = t[1]
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if i <= w - 2:
		k = input()
		a.sort()
		b.sort(reverse=True)
		i = 0
		flag = 0
		while i < len(a):
			if a[i] + b[i] <= x:
				i += 1
			else:
				print('No')
				flag = 1
				break
		if flag == 0:
			print('Yes')
	else:
		a.sort()
		b.sort(reverse=True)
		i = 0
		flag = 0
		while i < len(a):
			if a[i] + b[i] <= x:
				i += 1
			else:
				print('No')
				flag = 1
				break
		if flag == 0:
			print('Yes')


t = int(input())
for k in range(t):
	if k > 0:
		input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort(reverse=True)
	b.sort()
	for i in range(n):
		check = 0
		for j in range(len(b)):
			if a[i] + b[j] <= x:
				check = 1
				b.remove(b[j])
				break
		if check == 0:
			break
	if check == 1:
		print('Yes')
	else:
		print('No')


import bisect
from collections import Counter
t = int(input())
for k in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort()
	a.sort(reverse=True)
	vis = [0 for _ in range(n)]
	for i in range(n):
		num = a[i]
		ans = False
		for j in range(n):
			if vis[j] == 0 and num + b[j] <= x:
				vis[j] = 1
				ans = True
				break
		if not ans:
			break
	if ans:
		print('Yes')
	else:
		print('No')
	if k != t - 1:
		s = input()


def checker(a, b, n, x):
	for i in range(n):
		if a[i] + b[i] > x:
			return False
	return True
for _ in range(2 * int(input())):
	try:
		(n, x) = [int(i) for i in input().split()]
		A = [int(i) for i in input().split()]
		B = [int(i) for i in input().split()]
		A.sort()
		B.sort(reverse=True)
		print('YES' if checker(A, B, n, x) else 'NO')
	except:
		continue


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	cc = 0
	for i in range(n):
		if a[i] + b[i] > x:
			cc = 1
			break
	if cc == 1:
		print('No')
	else:
		print('Yes')
	input()


data_count = input()

def check(a, b, x):
	for i in range(len(a)):
		if a[i] + b[i] > x:
			return False
	return True
answers = []
for l in range(int(data_count)):
	(n, x) = tuple(map(int, input().split()))
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())), reverse=True)
	result = check(a, b, x)
	answers.append('Yes' if result else 'No')
	if l < int(data_count) - 1:
		input()
print('\n'.join(answers))


import sys
r = sys.stdin.readline

def comp(A: list, B: list) -> bool:
	B = list(reversed(B))
	for i in range(len(A)):
		if A[i] + B[i] > x:
			return False
	return True
T = int(r())
for i in range(T):
	(n, x) = map(int, r().split())
	A = list(map(int, r().split()))
	B = list(map(int, r().split()))
	if comp(A, B):
		print('Yes')
	else:
		print('No')
	if i != T - 1:
		r()


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if i < t - 1:
		_ = input()
	j = -1
	for z in a:
		if z + b[j] > x:
			print('No')
			break
		j -= 1
	else:
		print('Yes')


for i in range(int(input())):
	if i == 0:
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
	else:
		s = input()
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	cnt = 0
	for i in range(n):
		if a[i] + b[i] <= x:
			cnt += 1
			continue
		else:
			break
	if cnt == n:
		print('YES')
	else:
		print('NO')


T = int(input())
for z in range(T):
	s = input()
	if s == '':
		s = input()
	(n, x) = [int(c) for c in s.split()]
	a = [int(c) for c in input().split()]
	b = [int(c) for c in input().split()]
	a.sort()
	b.sort(reverse=True)
	control = 0
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			control = 1
			break
	if control == 0:
		print('Yes')


Tcases = int(input())
for j in range(Tcases):
	(n, x) = input().split()
	n = int(n)
	x = int(x)
	arrA = [int(a) for a in input().split()]
	arrB = [int(b) for b in input().split()]
	for i in range(n):
		if arrA[i] + arrB[n - 1 - i] > x:
			print('no')
			break
	else:
		print('yes')
	if j != Tcases - 1:
		input()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	if _ != 0:
		s = input().strip()
	(n, x) = map(int, input().split())
	L = list(map(int, input().split()))
	M = list(map(int, input().split()))
	L.sort()
	M.sort(reverse=True)
	for i in range(n):
		if L[i] + M[i] > x:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
for test in range(t):
	(n, x) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	a.sort()
	b.sort(reverse=True)
	found = False
	for i in range(n):
		if a[i] + b[i] > x:
			found = True
			print('No')
			break
	if not found:
		print('Yes')
	if test == t - 1:
		break
	n = input()


t = int(input())
for i in range(t):
	(lens, x) = [int(x) for x in input().split()]
	a = sorted([int(x) for x in input().split()], reverse=True)
	b = sorted([int(x) for x in input().split()])
	answer = 'YES'
	for (m, n) in zip(a, b):
		if m + n > x:
			answer = 'NO'
			break
	print(answer)
	if i != t - 1:
		input()


t = int(input())
for test in range(t):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))[:n]
	b = list(map(int, input().split()))[:n]
	if test < t - 1:
		nothing = input()
	a.sort()
	b.sort(reverse=True)
	res = None
	for i in range(n):
		if a[i] + b[i] > x:
			res = 'No'
			break
		elif i == n - 1 and a[i] + b[i] <= x:
			res = 'Yes'
	print(res)


def testcase():
	(n, x) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	arr.sort()
	brr.sort(reverse=True)
	for i in range(n):
		if arr[i] + brr[i] > x:
			print('No')
			return
	print('Yes')
	return
import sys, os
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
sys.setrecursionlimit(10 ** 5)
t = int(input())
for _ in range(t - 1):
	testcase()
	input()
testcase()


mod = 10 ** 9 + 7
INF = float('inf')

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

def readTuples():
	return tuple(map(int, input().split()))

def I():
	return int(input())
q = I()
ans = []
for _ in range(q):
	(n, x) = readInts()
	A = sorted(readInts())
	B = sorted(readInts(), reverse=True)
	for i in range(n):
		if A[i] + B[i] <= x:
			pass
		else:
			ans.append('No')
			break
	else:
		ans.append('Yes')
	if _ != q - 1:
		__ = input()
print(*ans, sep='\n')


c = int(input())
for _ in range(c):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if _ != c - 1:
		input()
	a.sort()
	b.sort(reverse=True)
	fl = True
	for i in range(n):
		if a[i] + b[i] > x:
			fl = False
			break
	if fl:
		print('YES')
	else:
		print('NO')


test = int(input())
while test != 0:
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if test != 1:
		input()
	a.sort()
	b.sort(reverse=True)
	flag = 0
	for i in range(n):
		if a[i] + b[i] <= k:
			continue
		else:
			flag = 1
			break
	if flag == 1:
		print('No')
	else:
		print('Yes')
	test -= 1


import io, os
R = lambda : map(int, input().split())
for _ in range(int(input())):
	s = list(R())
	if len(s) == 0:
		s = list(R())
	(n, x) = s
	a = list(R())
	b = list(R())
	a.sort()
	b.sort(reverse=True)
	can = False
	for i in range(n):
		if a[i] + b[i] > x:
			can = True
			break
	if not can:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l2.sort(reverse=True)
	f = 0
	try:
		f = input()
	except:
		pass
	for i in range(n):
		if l1[i] + l2[i] > x:
			f = 1
			break
	if f:
		print('No')
	else:
		print('Yes')


(I, q) = (lambda : map(int, input().split()), int(input()))
for j in range(q):
	(n, x) = I()
	(a, b, t) = (sorted(I()), sorted(I(), reverse=1), 1)
	for i in range(n):
		if a[i] + b[i] > x:
			t = 0
	print(['NO', 'YES'][t])
	if j < q - 1:
		input()


def solution(n, x, a, b):
	answer = ''
	b.sort(reverse=True)
	pick = [False for _ in range(len(b))]
	for i in range(len(a)):
		is_pop = False
		for j in range(len(b)):
			if a[i] + b[j] <= x and pick[j] == False:
				pick[j] = True
				is_pop = True
				break
		if is_pop == False:
			return 'No'
	return 'Yes'
t = int(input())
for tt in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print(solution(n, x, a, b))
	if tt < t - 1:
		input()


def func(a, b, x):
	a_sorted = sorted(a, reverse=True)
	b_sorted = sorted(b, reverse=True)
	idx = 0
	condition = len(b_sorted) > 0 and (not idx >= len(a))
	while condition:
		elem_to_pair = a_sorted[idx]
		for i in range(len(b_sorted)):
			if b_sorted[i] + elem_to_pair <= x:
				break
			if i == len(b_sorted) - 1:
				return 'No'
		idx += 1
		b_sorted.pop(i)
		condition = len(b_sorted) > 0 and (not idx >= len(a_sorted))
	return 'Yes'
t = int(input())
answers = []
for j in range(t):
	n_x = input().split()
	(n, x) = (int(n_x[0]), int(n_x[1]))
	a = list(map(float, input().split()))
	b = list(map(float, input().split()))
	if j < t - 1:
		_ = input()
	answer = func(a, b, x)
	answers.append(answer)
for answer in answers:
	print(answer)


t = int(input())
mas4 = ['']
for j in range(t):
	(a, b) = map(int, input().split())
	mas1 = list(map(int, input().split()))
	mas2 = list(map(int, input().split()))
	mas1.sort()
	mas2.sort(reverse=True)
	mas3 = [0] * a
	for i in range(a):
		mas3[i] = mas1[i] + mas2[i]
		if mas3[i] > b:
			mas4.append('No')
			break
		if i == a - 1:
			mas4.append('Yes')
	if j != t - 1:
		c = str(input())
for i in range(1, t + 1):
	print(mas4[i])


test = int(input())
for q in range(test):
	if q != test - 1:
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		a.sort()
		b.sort(reverse=True)
		for i in range(n):
			if a[i] + b[i] <= x:
				continue
			else:
				print('No')
				break
		else:
			print('Yes')
		m = input()
	else:
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		a.sort()
		b.sort(reverse=True)
		for i in range(n):
			if a[i] + b[i] <= x:
				continue
			else:
				print('No')
				break
		else:
			print('Yes')


t = int(input())
for j in range(t):
	m = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if j != t - 1:
		s = input()
	f = 0
	for i in range(m[0]):
		if a[i] + b[m[0] - 1 - i] > m[1]:
			f = 1
			break
	if f == 1:
		print('No')
	else:
		print('Yes')


t = int(input())

def bs(arr, mv, cv):
	(l, r) = (0, len(arr) - 1)
	while l <= r:
		m = l + (r - l) // 2
		v = arr[m] + cv
		if v < mv:
			l = m + 1
		elif v > mv:
			r = m - 1
		else:
			return m
	return l - 1
while t > 0:
	t -= 1
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	while n > 0:
		e = a[-1]
		ni = bs(b, x, e)
		if ni < 0:
			break
		if e + b[ni] <= x:
			a.pop()
			b.pop(ni)
			n -= 1
		else:
			break
	print('Yes' if n == 0 else 'No')
	if t > 0:
		input()


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
t = int(input())
for k in range(t):
	if k > 0:
		s = input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))[:n]
	b = list(map(int, input().split()))[:n]
	b.sort(reverse=True)
	flag = 0
	for i in range(n):
		if a[i] + b[i] > x:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input(''))
for k in range(t):
	(n, x) = map(int, input('').split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	i = 0
	j = n - 1
	a.sort()
	b.sort()
	ok = True
	for i in range(n):
		if b[i] + a[j] > x:
			ok = False
			break
		i += 1
		j -= 1
	if ok:
		print('Yes')
	else:
		print('No')
	if k < t - 1:
		d = input('')


t = int(input())
for i in range(t):
	if i > 0:
		input()
	(n, x) = map(int, input().split())
	(a, b) = ([*map(int, input().split())], [*map(int, input().split())][::-1])
	s = [a[i] + b[i] for i in range(n)]
	if max(s) > x:
		print('No')
	else:
		print('Yes')


import sys
import os
a = sys.stdin.readlines()

def line_to_array(line):
	res = []
	for n in line.split(' '):
		res.append(int(n))
	return res

def check(a1, a2, x):
	for (c, b) in zip(a1, a2):
		if not c + b <= x:
			return False
	return True
for i in range(len(a) // 4):
	start = i * 4
	b = line_to_array(a[start + 1])
	n = b[0]
	x = b[1]
	a1 = line_to_array(a[start + 2])
	a1.sort()
	a2 = line_to_array(a[start + 3])
	a2.sort()
	a2 = a2[::-1]
	if check(a1, a2, x):
		print('Yes')
	else:
		print('No')


m = int(input())
for t in range(m):
	if t != 0:
		b = input()
	nx = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	b.reverse()
	accept = 0
	for i in range(nx[0]):
		if a[i] + b[i] > nx[1]:
			accept = 1
			break
	if accept == 1:
		print('No')
	else:
		print('Yes')


count = int(input())
data = []
yes = 'Yes'
no = 'No'

def check_arrs(arr1, arr2, x):
	tmp = arr2.copy()
	tmp.reverse()
	for (i, el) in enumerate(arr1):
		el = int(el)
		if el > x:
			return no
		found = False
		for el1 in tmp:
			el1 = int(el1)
			if el1 > x:
				return no
			if el + el1 <= x:
				found = True
				tmp.remove(str(el1))
				break
		if not found:
			return no
	return yes
for i in range(0, count):
	tmp = []
	tmp.insert(len(tmp), input())
	tmp.insert(len(tmp), input())
	tmp.insert(len(tmp), input())
	data.insert(len(data), tmp)
	if i != count - 1:
		input()
for task in data:
	[cond, arr1, arr2] = task
	[c, x] = cond.split(' ')
	arr1 = arr1.split(' ')
	arr2 = arr2.split(' ')
	x = int(x)
	print(check_arrs(arr1, arr2, x))


t = int(input())
while t > 0:
	t -= 1
	(n, x) = map(int, input().strip().split(' '))
	a = list(map(int, input().strip().split(' ')))
	b = list(map(int, input().strip().split(' ')))
	poss = True
	b = b[::-1]
	for i in range(n):
		if a[i] + b[i] > x:
			poss = False
			break
	if poss:
		print('Yes')
	else:
		print('No')
	if t > 0:
		f = input()


t = int(input())
for _ in range(t):
	ans = 'Yes'
	(n, x) = map(int, input().split())
	(a, b) = ([*map(int, input().split())], [*map(int, input().split())])
	(a, b) = (sorted(a, reverse=True), sorted(b))
	for (i, j) in zip(a, b):
		if i + j > x:
			ans = 'No'
	print(ans)
	if _ != t - 1:
		input()


import sys
t = int(sys.stdin.readline().rstrip())
for _ in range(t):
	(n, x) = list(map(int, sys.stdin.readline().rstrip().split(' ')))
	a = list(map(int, sys.stdin.readline().strip().split(' ')))
	b = list(map(int, sys.stdin.readline().strip().split(' ')))
	if _ < t - 1:
		qqq = sys.stdin.readline()
	a = sorted(a)
	b = sorted(b, reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
for case in range(t - 1):
	x = int(input().split(' ')[1])
	(a, b) = ([], [])
	for num in input().split(' '):
		a.append(int(num))
	for num in input().split(' '):
		b.append(int(num))
	(a, b) = (sorted(a), sorted(b))
	patata = True
	for i in range(len(a)):
		if a[i] + b[len(a) - i - 1] > x:
			patata = False
			break
	if patata:
		print('Yes')
	else:
		print('No')
	input()
for i in range(1):
	x = int(input().split(' ')[1])
	(a, b) = ([], [])
	for num in input().split(' '):
		a.append(int(num))
	for num in input().split(' '):
		b.append(int(num))
	(a, b) = (sorted(a), sorted(b))
	patata = True
	for i in range(len(a)):
		if a[i] + b[len(a) - i - 1] > x:
			patata = False
			break
	if patata:
		print('Yes')
	else:
		print('No')


t = int(input())
arg = True
for j in range(t):
	(n, x) = map(int, input().split())
	a = [int(s) for s in input().split()]
	b = [int(s) for s in input().split()]
	b = list(reversed(b))
	for i in range(n):
		if a[i] + b[i] > x:
			arg = False
			break
	if arg:
		print('Yes')
	else:
		print('No')
	arg = True
	if j != t - 1:
		input()


import sys

def main():
	inp = sys.stdin.read().strip().split('\n')
	out = []
	for i in range(1, len(inp), 4):
		(_, x) = map(int, inp[i].split())
		a = sorted(map(int, inp[i + 1].split()))
		b = sorted(map(int, inp[i + 2].split()), reverse=True)
		out.append(('NO', 'YES')[all((i + j <= x for (i, j) in zip(a, b)))])
	return out
print(*main(), sep='\n')


import sys
LI = lambda : list(map(int, sys.stdin.readline().split()))
MI = lambda : map(int, sys.stdin.readline().split())
SI = lambda : sys.stdin.readline().strip('\n')
II = lambda : int(sys.stdin.readline())
for _ in range(II()):
	(n, x) = MI()
	a = sorted(MI())
	b = sorted(MI(), reverse=True)
	ok = True
	for i in range(n):
		if a[i] + b[i] > x:
			ok = False
	print(['NO', 'YES'][ok])
	s = SI()


t = int(input())
for i in range(t):
	if i > 0:
		d = input()
	(n, x) = [int(i) for i in input().split()]
	a = sorted([int(i) for i in input().split()])
	b = sorted([int(i) for i in input().split()])
	s = 0
	for i in range(n):
		if a[i] + b[-i - 1] <= x:
			s += 1
	if s == n:
		print('YES')
	else:
		print('NO')


x = int(input())
for i in range(x):
	(a, b) = map(int, input().split())
	ar1 = list(map(int, input().split()))
	ar2 = list(map(int, input().split()))
	ar2 = sorted(ar2)[::-1]
	t = 0
	for j in range(len(ar1)):
		if ar1[j] + ar2[j] > b:
			t = 1
		if t == 1:
			break
	if t == 0:
		print('Yes')
	else:
		print('No')
	if i < x - 1:
		input()


import sys
import math

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

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

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

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	(n, x) = MI()
	a = LI()
	b = LI()
	a.sort()
	boo = True
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			boo = False
			break
	print('Yes' if boo else 'No')
	if q != t - 1:
		a = input()


yes = 'Yes'
no = 'No'

def fun(ls, lt, k):
	a = sorted(ls)
	b = sorted(lt)
	for (i, j) in zip(a, b[::-1]):
		if i + j > k:
			print(no)
			return
	print(yes)
T = int(input())
for i in range(T):
	(n, k) = list(map(int, input().split()))
	ls = list(map(int, input().split()))
	lt = list(map(int, input().split()))
	fun(ls, lt, k)
	if i != T - 1:
		v = input()


t = int(input())
for i in range(t - 1):
	l = input()
	L = l.split()
	(n, x) = (int(L[0]), int(L[1]))
	a = input()
	A = a.split()
	for i in range(n):
		A[i] = int(A[i])
	b = input()
	B = b.split()
	for i in range(n):
		B[i] = int(B[i])
	A.sort()
	B.sort(reverse=True)
	test = True
	for i in range(n):
		if A[i] + B[i] > x:
			test = False
			break
	if test == True:
		print('Yes')
	else:
		print('No')
	c = input()
l = input()
L = l.split()
(n, x) = (int(L[0]), int(L[1]))
a = input()
A = a.split()
for i in range(n):
	A[i] = int(A[i])
b = input()
B = b.split()
for i in range(n):
	B[i] = int(B[i])
A.sort()
B.sort(reverse=True)
test = True
for i in range(n):
	if A[i] + B[i] > x:
		test = False
		break
if test == True:
	print('Yes')
else:
	print('No')


t = int(input())
for i in range(t):
	l = [int(i) for i in input().split()]
	n = l[0]
	x = l[1]
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	if i != t - 1:
		_ = input()
	a.sort()
	b.sort(reverse=True)
	s = [a[i] + b[i] for i in range(n)]
	if max(s) > x:
		print('No')
	else:
		print('Yes')


from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))

def check(a, b, n, x):
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			return
	print('Yes')
for _ in range(I()):
	if _ != 0:
		a = input()
	(n, x) = M()
	a = LI()
	b = LI()
	a.sort()
	b.sort(reverse=True)
	check(a, b, n, x)


from collections import defaultdict
t = int(input())
for qq in range(t):
	(n, e) = [int(x) for x in input().split()]
	x = e
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	a.sort()
	b.sort()
	b.reverse()
	f = 0
	for i in range(n):
		if a[i] + b[i] > x:
			f = 1
			break
	if f == 1:
		print('No')
	else:
		print('Yes')
	if qq != t - 1:
		w = input()


n = int(input())
for p in range(n):
	(n1, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))[::-1]
	if p != n - 1:
		z = input()
	for x in range(n1):
		if a[x] + b[x] > k:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
result = []
for k in range(t):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = sorted(map(int, input().split()), reverse=True)
	status = True
	for i in range(n):
		if a[i] + b[i] > x:
			status = False
			break
	result.append('YES' if status else 'NO')
	if k < t - 1:
		input()
for i in result:
	print(i)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	if i != t - 1:
		space = input()
	arr2 = sorted(arr2, reverse=True)
	flag = True
	for i in range(len(arr1)):
		if arr1[i] + arr2[i] <= x:
			continue
		else:
			flag = False
			break
	if flag == False:
		print('No')
	else:
		print('Yes')


ans = []
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))[:n]
	b = list(map(int, input().split()))[:n]
	a.sort()
	b.sort(reverse=True)
	for j in range(n):
		if a[j] + b[j] > x:
			ans.append('No')
			break
	else:
		ans.append('Yes')
	if i != t - 1:
		input()
for i in ans:
	print(i)


n = int(input())
for i in range(0, n):
	G = 0
	if i != 0:
		F = input()
	p = input().rstrip().split(' ')
	q = input().rstrip().split(' ')
	r = input().rstrip().split(' ')
	q.sort(key=int)
	r.sort(key=int, reverse=True)
	for j in range(0, len(q)):
		if int(q[j]) + int(r[j]) <= int(p[1]):
			continue
		else:
			G = 1
			break
	if G == 1:
		print('No')
	else:
		print('Yes')


T = int(input())
for t in range(T):
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	ab = True
	abr = True
	for (a, b, br) in zip(A, B, B[::-1]):
		if a + b > x:
			ab = False
		if a + br > x:
			abr = False
	if ab or abr:
		print('Yes')
	else:
		print('No')
	if t < T - 1:
		tmp = input()


p = int(input())
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
b = b[::-1]
poss = True
for i in range(n):
	if a[i] + b[i] > k:
		poss = False
if poss:
	print('YES')
else:
	print('NO')
for t in range(p - 1):
	kkk = input()
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	b = b[::-1]
	poss = True
	for i in range(n):
		if a[i] + b[i] > k:
			poss = False
	if poss:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if i != t - 1:
		p = input()
	a.sort()
	b.sort()
	t1 = True
	for j in range(n):
		if a[j] + b[n - j - 1] > x:
			t1 = False
			print('No')
			break
	if t1:
		print('Yes')


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	if _ != t - 1:
		inp = input()
	diff = []
	f = 0
	for i in range(n):
		if l1[i] >= x:
			f = 1
			break
		diff.append(x - l1[i])
	if f == 1:
		print('NO')
	else:
		diff.sort()
		l2.sort()
		for i in range(n):
			if l2[i] > diff[i]:
				f = 1
				break
		if f == 0:
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t - 1):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))[::-1]
	ans = 'YES'
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 'NO'
			break
	print(ans)
	input()
(n, x) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))[::-1]
ans = 'YES'
for i in range(n):
	if a[i] + b[i] > x:
		ans = 'NO'
		break
print(ans)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = [int(a) for a in input().split()]
	a.sort()
	b = [int(b) for b in input().split()]
	b.sort(reverse=True)
	if i < t - 1:
		m = input()
	c = 0
	if n == 1:
		print('Yes' if a[0] + b[0] <= x else 'No')
	else:
		for j in range(n):
			if a[j] + b[j] > x:
				c = 1
				break
		print('Yes' if c == 0 else 'No')


import itertools
import math
import sys
import os
from collections import defaultdict

def is_debug():
	return 'PYPY3_HOME' not in os.environ

def stdin_wrapper():
	data = '4\n3 4\n1 2 3\n1 1 2\n\n2 6\n1 4\n2 5\n\n4 4\n1 2 3 4\n1 2 3 4\n\n1 5\n5\n5\n\n\n'
	for line in data.split('\n'):
		yield line
if not is_debug():

	def stdin_wrapper():
		while True:
			yield sys.stdin.readline()
inputs = stdin_wrapper()

def input_wrapper():
	return next(inputs)

def get_str():
	if is_debug():
		return input_wrapper()
	return input()

def get(_type):
	if _type == str:
		return get_str()
	return _type(input_wrapper())

def get_arr(_type):
	return [_type(x) for x in input_wrapper().split()]

def tuplerize(method):

	def wrap(*args, **kwargs):
		res = method(*args, **kwargs)
		if not isinstance(res, (tuple, list)):
			res = (res,)
		return res
	return wrap

@tuplerize
def solve(x, a, b):
	return 'Yes' if max([i + j for (i, j) in zip(sorted(a), reversed(sorted(b)))]) <= x else 'No'
t = get(int)
for _ in range(t):
	(n, x) = get_arr(int)
	a = get_arr(int)
	b = get_arr(int)
	get_arr(int)
	print(*solve(x, a, b))


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	ind = 0
	for i in b[::-1]:
		if a[ind] + i > x:
			print('No')
			break
		ind += 1
	else:
		print('Yes')
	if t > 1 and _ < t - 1:
		gar = input()


from sys import stdin, stdout

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

def readLine():
	return stdin.readline().strip()

def readInt():
	return int(stdin.readline().strip())
n = int(input())
for _ in range(n):
	(a, b) = readArr()
	(a, b) = (int(a), int(b))
	arr = readArr()
	brr = readArr()
	if _ != n - 1:
		s = readLine()
	arr.sort()
	brr.sort(reverse=True)
	check = True
	for (x, y) in zip(arr, brr):
		if x + y > b:
			check = False
	if check:
		print('YES')
	else:
		print('NO')


import math

def lcm(a, b):
	m = a * b
	while a != 0 and b != 0:
		if a > b:
			a %= b
		else:
			b %= a
	return m // (a + b)

def dtod(a):
	s = ''
	while a != 0:
		s += str(a % 2)
		a = int(a / 2)
	return s[::-1]
n = int(input())
for i in range(n):
	if i > 0:
		input()
	s = input().split(' ')
	m = int(s[0])
	x = int(s[1])
	s1 = input().split(' ')
	a = []
	for c in s1:
		a.append(int(c))
	s1 = input().split(' ')
	b = []
	for c in s1:
		b.append(int(c))
	a.sort()
	b.sort()
	b.reverse()
	f = False
	for i in range(m):
		if a[i] + b[i] > x:
			f = True
			break
	if f == False:
		print('Yes')
	else:
		print('No')


def sort_exists(n, a, b, x):
	a.sort()
	b = list(reversed(sorted(b)))
	for i in range(n):
		if a[i] + b[i] > x:
			return False
	return True

def process_tests():
	t = int(input())
	for i in range(t - 1):
		(n, x) = map(int, input().split())
		a = [int(v) for v in input().split()]
		b = [int(v) for v in input().split()]
		input()
		print('Yes' if sort_exists(n, a, b, x) else 'No')
	(n, x) = map(int, input().split())
	a = [int(v) for v in input().split()]
	b = [int(v) for v in input().split()]
	print('Yes' if sort_exists(n, a, b, x) else 'No')
process_tests()


import sys
for _ in range(int(sys.stdin.readline())):
	c = list(map(int, sys.stdin.readline().strip().split(' ')))
	a = list(map(int, sys.stdin.readline().strip().split(' ')))
	b = list(map(int, sys.stdin.readline().strip().split(' ')))
	for i in range(c[0]):
		if a[i] + b[c[0] - 1 - i] > c[1]:
			print('No')
			break
	else:
		print('Yes')
	a = sys.stdin.readline()


import sys
inp = sys.stdin.readline

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

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

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

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

def handle():
	t = input()
	for case in range(t):
		(n, x) = invr()
		a = list(invr())
		b = list(invr())
		flag = False
		for a_index in range(n - 1, -1, -1):
			if a[a_index] + b[n - a_index - 1] > x:
				flag = True
				break
		if not flag:
			print('Yes')
		else:
			print('No')
		if case != t - 1:
			inp()
handle()


import sys
input = sys.stdin.readline
TK = int(input())
for T in range(TK):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))[::-1]
	flag = False
	for i in range(n):
		t = a[i] + b[i]
		if t > k:
			flag = True
			break
	print('No' if flag else 'Yes')
	if TK - 1 != T:
		input()


n = int(input())
for _ in range(n):
	if _ > 0:
		s = input()
	(n, x) = list(map(int, input().split()))
	(p1, p2) = (list(map(int, input().split())), list(map(int, input().split())))
	p1.sort()
	p2.reverse()
	ans = 0
	for j in range(n):
		if p1[j] + p2[j] > x:
			ans = 1
			print('No')
			break
	if ans == 0:
		print('Yes')


t = int(input())
for a in range(t):
	(n, x) = map(int, input().split())
	A = [int(i) for i in input().split()]
	B = [int(i) for i in input().split()]
	A.sort()
	B.sort(reverse=True)
	ans = True
	for i in range(n):
		if A[i] + B[i] <= x:
			continue
		else:
			ans = False
			break
	if ans == True:
		print('Yes')
	else:
		print('No')
	if a != t - 1:
		blank = input()


import sys
input = sys.stdin.readline
from collections import defaultdict
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	input()
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
for t in [wtf[i:i + 4] for i in range(1, len(wtf), 4)]:
	(n, x) = map(int, t[0].split())
	A = list(map(int, t[1].split()))
	B = list(map(int, t[2].split()))
	B = sorted(B, reverse=True)
	f = True
	for i in range(n):
		if A[i] + B[i] > x:
			f = False
			break
	print('Yes' if f else 'No')


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))[::-1]
	c = [a[i] + b[i] for i in range(n)]
	if max(c) <= x:
		print('Yes')
	else:
		print('No')
	if _ < t - 1:
		input()


t = int(input())
for test in range(t):
	temp = list(map(int, input().split()))
	n = temp[0]
	x = temp[1]
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if test != t - 1:
		temp = input()
	a.sort()
	b.sort(reverse=True)
	check = True
	for i in range(n):
		if a[i] + b[i] > x:
			check = False
			print('NO')
			break
	if check:
		print('YES')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = sorted(map(int, input().split()), reverse=True)
	if i != t - 1:
		input()
	for el in a:
		num = x - el
		if num < 0:
			print('No')
			break
		else:
			for elem in b:
				if elem <= num:
					b.remove(elem)
					break
			else:
				print('No')
				break
	else:
		print('Yes')


for _ in range(int(input())):
	if _ != 0:
		input()
	(n, x) = map(int, input().split())
	a = sorted(map(int, input().split()))
	b = sorted(map(int, input().split()), reverse=True)
	c = 0
	for i in range(n):
		if a[i] + b[i] <= x:
			c = c + 1
	if c == n:
		print('Yes')
	else:
		print('No')


tc = int(input())
for t in range(tc):
	(n, x) = [int(num) for num in input().split()]
	a = [int(num) for num in input().split()]
	b = [int(num) for num in input().split()]
	c = [n1 + n2 > x for (n1, n2) in zip(a, b[::-1])]
	if any(c):
		print('No')
	else:
		print('Yes')
	if t < tc - 1:
		_ = input()


import sys

def rr():
	return sys.stdin.readline().rstrip()
rp = print

def print(*args, **kwargs):
	rp('DBG:# ', *args, **kwargs, file=sys.stderr)

def rri():
	return int(rr())

def rrl():
	return list(map(int, rr().split()))

def rrt():
	return tuple(map(int, rr().split()))

def rrle():
	return (line.rstrip() for line in sys.stdin.readlines())

def rrtl():
	return [tuple(map(int, l.split())) for l in rrle()]
from collections import defaultdict

def mus(d=lambda : 0):
	return defaultdict(lambda : defaultdict(d))

def dd0(d=lambda : 0):
	return defaultdict(d)

def ms(x, y, d=0):
	return [[0] * y for i in range(x)]

def ar(x, d=0):
	return [d] * x

def ppm(m, n=0, x=0, y=0):
	print('\n'.join(('\t'.join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))

def ppa(a, n):
	print('\t'.join(map(str, a[0:n])))

def ppl(a=0, x=[1]):
	x[0] = a or x[0] + 1
	print('-' + '- -' * 14 + '-# ' + str(x[0] - 2) + ' #-' + '- -' * 14 + '-')

def fltn(a):
	(i for sub in a for i in sub)

def yn(x):
	return 'YES' if x else 'NO'
from itertools import tee
from itertools import accumulate
from itertools import groupby
from itertools import permutations

def pairwise(iterable):
	(a, b) = tee(iterable)
	next(b, None)
	return zip(a, b)

def grp(x, key=None):
	return ((i, sum((1 for _ in g))) for (i, g) in groupby(x, key=key))
import math

def rnar():
	return (*rrl(), rrl())

def rn():
	return (*rrl(),)

def dpp(a, b=''):
	print('#| {} |#:^ {} ^:'.format(a, b))

def str_join(i, sep=' '):
	return sep.join(map(str, i))
MOD17 = 10 ** 9 + 7

def read():
	(n, x) = rrl()
	a = rrl()
	b = rrl()
	return (n, x, a, b)

def solve(n, x, a, b):
	return yn(all((i + j <= x for (i, j) in zip(a, b[::-1]))))
test_count = rri()
for _ in range(test_count):
	input_data = read()
	if _ != range(test_count):
		rr()
	result = solve(*input_data)
	rp(result)


import sys, math
input = lambda : sys.stdin.readline().strip()
inp = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	(n, k) = inp()
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b = b[::-1]
	l = input()
	f = True
	for i in range(n):
		if a[i] + b[i] > k:
			f = False
			break
	print('YES' if f == True else 'NO')


t = int(input())
for i in range(t):
	(n, x) = input().split()
	(n, x) = (int(n), int(x))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(key=lambda P: -1 * P)
	Possible = True
	for j in range(n):
		if a[j] + b[j] > x:
			Possible = False
	if Possible:
		print('Yes')
	else:
		print('No')
	if i < t - 1:
		temp = input()


for t in range(int(input())):
	if t > 0:
		a1 = input()
	(n, x) = map(int, input().split())
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	a.sort(reverse=True)
	b.sort()
	x1 = True
	for i in range(n):
		if a[i] + b[i] > x:
			x1 = False
			break
	if x1:
		print('Yes')
	else:
		print('No')


def main():
	t = int(input())
	while t > 0:
		(n, x) = map(int, input().split())
		li1 = list(map(int, input().split()))
		li1.sort(reverse=True)
		li2 = list(map(int, input().split()))
		found = 1
		for i in range(n):
			if li1[i] + li2[i] <= x:
				pass
			else:
				found = 0
				break
		if found == 1:
			print('Yes')
		else:
			print('No')
		if t > 1:
			st = input()
		t -= 1
main()


nn = int(input())
for t in range(nn):
	(n, x) = map(int, input().split())
	ar = list(map(int, input().split()))
	ar2 = list(map(int, input().split()))
	if t != nn - 1:
		spac = input()
	ar.sort()
	ar2.sort(reverse=True)
	for i in range(n):
		if ar[i] + ar2[i] > x:
			print('NO')
			break
	else:
		print('YES')


def check():
	(n, x) = map(int, input().split())
	ar1 = list(map(int, input().split()))
	ar2 = list(map(int, input().split()))
	ar2 = ar2[::-1]
	for i in range(n):
		if ar1[i] + ar2[i] > x:
			return 'No'
	return 'Yes'
k = int(input())
for i in range(k):
	print(check())
	if i != k - 1:
		input()


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	lst1 = list(map(int, input().split()))
	lst2 = list(map(int, input().split()))
	lst1 = sorted(lst1)[::-1]
	i = 0
	f = 0
	while i < n:
		if lst1[i] + lst2[i] > x:
			f = 1
			break
		i += 1
	if f != 0:
		print('No')
	if f == 0:
		print('Yes')
	if _ != t - 1:
		f = input()


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	h = list(map(int, input().split()))
	l = list(map(int, input().split()))
	h.sort()
	l.sort(reverse=True)
	c = 0
	for j in range(a):
		if h[j] + l[j] <= b:
			c += 1
	if c == a:
		print('Yes')
	else:
		print('No')
	if i < n - 1:
		s = input()


for t in range(int(input())):
	if t != 0:
		n1 = input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a = list(sorted(a))
	b = list(sorted(b, reverse=True))
	m = True
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			m = False
			break
	if m:
		print('Yes')


l = int(input())
for i in range(l):
	(n, k) = map(int, input().split())
	mas1 = sorted(list(map(int, input().split())))
	mas2 = sorted(list(map(int, input().split())))
	tf = True
	for j in range(n):
		if mas1[j] + mas2[n - j - 1] > k:
			tf = False
			break
	if tf:
		print('Yes')
	else:
		print('No')
	if i != l - 1:
		s = input()


def myinput():
	while True:
		str = input()
		if len(str) == 0:
			continue
		return str
t = int(input())
for i in range(t):
	(n, x) = [int(x) for x in myinput().split()]
	a = [int(x) for x in myinput().split()]
	b = [int(x) for x in myinput().split()]
	a.sort()
	b.sort()
	canAdd = True
	for j in range(n):
		if a[j] + b[n - 1 - j] > x:
			canAdd = False
	if canAdd:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	ans = 'Yes'
	b.sort(reverse=True)
	for k in range(n):
		if a[k] + b[k] > x:
			ans = 'No'
	print(ans)
	if i != t - 1:
		s = input()


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
for _ in range(int(input())):
	if _ != 0:
		p = input()
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	ch = 1
	for i in range(n):
		if a[i] + b[i] > k:
			ch = 0
			break
	if ch:
		print('Yes')
	else:
		print('No')


import math
m = int(input())
while m > 0:
	(n, k) = map(int, input().split())
	list1 = list(map(int, input().split()))
	list2 = list(map(int, input().split()))
	for i in range(n):
		if list1[i] + list2[n - i - 1] > k:
			print('NO')
			break
	else:
		print('YES')
	if m > 1:
		g = input()
	m = m - 1


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.reverse()
	add = lambda q: q[0] + q[1]
	if max(map(add, zip(a, b))) > x:
		print('No')
	else:
		print('Yes')
	if _ < t - 1:
		input()


t = int(input())
z = []
i = 0
while i < t:
	c = 0
	A = list(map(int, input().split()))
	n = A[0]
	x = A[1]
	a = [int(j) for j in input().split()]
	b = [int(g) for g in input().split()]
	a = a[::-1]
	d = 0
	while d < n:
		if a[d] + b[d] > x:
			c += 1
		d += 1
	if c > 0:
		z.append('No')
	else:
		z.append('Yes')
	if i < t - 1:
		m = input()
	i += 1
i = 0
while i < len(z):
	print(z[i])
	i += 1


n = int(input())
for j in range(n):
	(a, b) = [int(i) for i in input().split()]
	c = [int(i) for i in input().split()]
	d = [int(i) for i in input().split()]
	d = sorted(d, reverse=True)
	if j != n - 1:
		s = str(input())
	flag = 0
	for i in range(0, len(d)):
		if c[i] + d[i] <= b:
			pass
		else:
			flag = 1
			break
	if flag == 0:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	m = 0
	g = input().split()
	a = [int(j) for j in input().split()]
	b = [int(k) for k in input().split()]
	n = int(g[0])
	x = int(g[1])
	try:
		input()
	except:
		EOFError
	b = sorted(b, reverse=True)
	for (v, w) in enumerate(a):
		if b[v] + w <= x:
			m = m + 1
	if m == n:
		print('Yes')
	else:
		print('No')


T = int(input())
for t in range(T):
	st = input().split()
	n = int(st[0])
	x = int(st[1])
	A = []
	B = []
	stA = input().split()
	stB = input().split()
	for i in range(n):
		A.append(int(stA[i]))
		B.append(int(stB[i]))
	ok = True
	for i in range(n):
		if A[i] + B[n - 1 - i] > x:
			ok = False
			break
	if ok:
		print('Yes')
	else:
		print('No')
	if t != T - 1:
		input()


try:
	for _ in range(int(input())):
		(n, x) = map(int, input().split())
		a = sorted([int(i) for i in input().split()])
		b = sorted([int(i) for i in input().split()], reverse=True)
		ans = 'Yes'
		for i in range(n):
			if a[i] + b[i] > x:
				ans = 'No'
				break
		print(ans)
		a = input()
except:
	pass


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = sorted(map(int, input().split()))
	b = sorted(map(int, input().split()))
	f = 1
	for i in a:
		j = len(b) - 1
		while i + b[j] > x:
			j -= 1
			if j < 0:
				f = 0
				break
		b.remove(b[j])
		if f == 0:
			break
	if f == 1:
		print('Yes')
	else:
		print('No')
	if _ != t - 1:
		input()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

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

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def solve(case):
	(n, x) = sep()
	a = lis()
	b = lis()
	b = b[::-1]
	f = True
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			f = False
			break
	if f:
		print('Yes')
	inp()
testcase(int(inp()))


from sys import stdin, stdout
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
t = int(input())
for _ in range(t):
	(n, x) = mp()
	a = li()
	b = li()
	a.sort()
	b.sort(reverse=True)
	for (i, j) in zip(a, b):
		if i + j > x:
			print('No')
			break
	else:
		print('Yes')
	if _ != t - 1:
		s = input()


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


def solve(a, b, n, x):
	for i in range(n):
		if a[i] + b[i] > x:
			return 'No'
	return 'Yes'
t = int(input())
for k in range(t):
	if k != t - 1:
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))[::-1]
		s = input()
		print(solve(a, b, n, x))
	else:
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))[::-1]
		print(solve(a, b, n, x))


def compute(a, b, x):
	b.reverse()
	for i in range(len(a)):
		if a[i] + b[i] > x:
			return False
	return True
q = int(input())
for q_itr in range(q):
	nm = input().split()
	n = int(nm[0])
	x = int(nm[1])
	a = list(map(int, input().rstrip().split()))
	b = list(map(int, input().rstrip().split()))
	try:
		input()
	except:
		pass
	if compute(a, b, x):
		print('Yes')
	else:
		print('No')


import sys
import math
import collections

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

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

def get_string():
	return sys.stdin.readline().strip()
t = int(input())
for no in range(t):
	(n, k) = get_ints()
	arr = get_list()
	b = get_list()
	if no < t - 1:
		blank = input()
	arr.sort(reverse=True)
	b.sort()
	maxim = 0
	for i in range(n):
		s = arr[i] + b[i]
		maxim = max(maxim, s)
	if maxim > k:
		print('No')
	else:
		print('Yes')


t = int(input())
outputs = [''] * t
for i in range(t):
	(n, x) = [int(k) for k in input().split()]
	a = [int(u) for u in input().split()]
	b = [int(u) for u in input().split()]
	while a:
		if a.pop(a.index(max(a))) + b.pop(b.index(min(b))) > x:
			outputs[i] = 'No'
			break
	else:
		outputs[i] = 'Yes'
	if i != t - 1:
		input()
for out in outputs:
	print(out)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())))[::-1]
	d = [a[j] + b[j] for j in range(n)]
	print('Yes' if max(d) <= x else 'No')
	if i != t - 1:
		input()


t = int(input())
import sys
while t > 0:
	t -= 1
	(n, x) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	blank = sys.stdin.readline()
	a.sort()
	b.sort(reverse=True)
	poss = True
	for i in range(n):
		if a[i] + b[i] <= x:
			pass
		else:
			poss = False
			break
	if poss == True:
		print('Yes')
	else:
		print('No')


from sys import stdin
from math import *
t = int(input())
for __ in range(t):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if __ != t - 1:
		c = input()
	a.sort()
	b.sort(reverse=True)
	ans = 'Yes'
	for i in range(n):
		if a[i] + b[i] > m:
			ans = 'No'
	print(ans)


test = int(input())
for t in range(test):
	(n, m) = map(int, input().split())
	x = list(map(int, input().split()))
	y = list(map(int, input().split()))
	x.sort()
	y.sort(reverse=True)
	flag = True
	for i in range(n):
		if x[i] + y[i] > m:
			flag = False
			break
	print('YES' if flag else 'NO')
	if t < test - 1:
		_ = input()


from sys import stdin
s1 = ''
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l1.sort(reverse=True)
	l2.sort()
	i = 0
	ok = False
	while i < n:
		if l1[i] + l2[i] > x:
			s1 += 'No\n'
			ok = True
			break
		i += 1
	if not ok:
		s1 += 'Yes\n'
	s = stdin.readline()
print(s1)


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if j == t - 1:
		b.sort()
	else:
		e = input()
	a.sort(reverse=True)
	b.sort()
	f = 0
	for i in range(0, n):
		if a[i] + b[i] > x:
			f = 1
	if f == 0:
		print('Yes')
	else:
		print('No')


j = int(input())
for y in range(j):
	nx = list(map(int, input().rstrip().rsplit()))
	(n, x, flag) = (nx[0], nx[1], 0)
	a = list(map(int, input().rstrip().rsplit()))
	b = list(map(int, input().rstrip().rsplit()))
	b.sort(reverse=True)
	a.sort()
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			flag = 1
			break
	if flag == 0:
		print('Yes')
	if y < j - 1:
		s = input()


from sys import stdin, stdout
t = int(stdin.readline())
for i in range(t):
	(n, k) = list(map(int, stdin.readline().split()))
	a = list(map(int, stdin.readline().split()))
	b = list(map(int, stdin.readline().split()))
	a.sort()
	b.sort(reverse=True)
	f = 1
	for (aa, bb) in zip(a, b):
		if aa + bb > k:
			f = 0
			break
	print('Yes' if f else 'No')
	if i != t - 1:
		s = input()


import sys

def rs():
	return sys.stdin.readline().rstrip()

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

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

def ws(s):
	sys.stdout.write(s + '\n')

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math
from collections import defaultdict, Counter
tc = ri()
for t in range(tc):
	(n, x) = ria()
	a = ria()
	b = ria()
	if t != tc - 1:
		z = rs()
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			ws('No')
			break
	else:
		ws('Yes')


def solve(a, b, x):
	a.sort()
	b.sort(reverse=True)
	for i in range(len(a)):
		if a[i] + b[i] <= x:
			continue
		return False
	return True
tt = int(input())
for j in range(tt):
	(n, x) = input().split()
	n = int(x)
	x = int(x)
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if solve(a, b, x):
		print('Yes')
	else:
		print('No')
	if j != tt - 1:
		input()


t = int(input())
res = []
for i in range(0, t):
	(n, x) = input().split()
	n = int(n)
	x = int(x)
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	if i != t - 1:
		blank = input()
	a_1 = sorted(a)
	b_1 = sorted(b, reverse=True)
	sum = []
	for i in range(0, n):
		sum.append(a_1[i] + b_1[i])
	result = 'Yes'
	for j in sum:
		if j > x:
			result = 'No'
			break
	res.append(result)
for i in res:
	print(i)


t = int(input())
for k in range(t):
	(n, x) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	a.sort()
	b.sort(reverse=True)
	for (y, z) in zip(a, b):
		if x < y + z:
			print('No')
			break
	else:
		print('Yes')
	if k < t - 1:
		input()


t = int(input())
for k in range(t):
	(n, x) = map(int, input().split())
	a = sorted([*map(int, input().split())])
	b = sorted([*map(int, input().split())])
	print('YES' if all([True if i + j <= x else False for (i, j) in zip(a[:], b[::-1])]) else 'NO')
	if k == t - 1:
		break
	else:
		input()


for t in range(int(input())):
	if t > 0:
		st = input()
	(n, x) = map(int, input().split())
	f = 0
	arr = list(map(int, input().split()))
	ls = sorted(list(map(int, input().split())), reverse=True)
	for i in range(n):
		if arr[i] + ls[i] > x:
			f = 1
			break
	print('YES' if f == 0 else 'NO')


t = int(input())
for q in range(t):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if q < t - 1:
		enter = input()
	flag = True
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			flag = False
			break
	if flag:
		print('Yes')


from sys import stdin as stin, stdout as stout, setrecursionlimit as srl
from collections import defaultdict as dd, Counter, deque as dq

def get_ints():
	return map(int, stin.readline().split())

def get_list():
	return list(map(int, stin.readline().split()))

def get_int():
	return int(stin.readline())

def get_str():
	return stin.readline()
k = get_int()
for j in range(k):
	(n, x) = get_ints()
	a = get_list()
	b = get_list()
	a.sort(reverse=True)
	b.sort()
	flag = 1
	for i in range(n):
		if a[i] + b[i] > x:
			flag = 0
			break
	if flag:
		print('Yes')
	else:
		print('No')
	if j < k - 1:
		input()


t = int(input())
for something in range(t):
	(n, x) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	ans = 'Yes'
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			ans = 'No'
			break
	print(ans)
	if something != t - 1:
		input()


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	A.sort(reverse=True)
	flag = True
	for i in range(n):
		if A[i] + B[i] > x:
			flag = False
	if flag:
		print('Yes')
	else:
		print('No')
	if _ < t - 1:
		A = input()


t = int(input())
while t > 0:
	t -= 1
	(n, x) = map(int, input().split(' '))
	A = list(map(int, input().split(' ')))
	B = list(map(int, input().split(' ')))
	if t > 0:
		bp = input()
	B.sort(reverse=True)
	for i in range(n):
		if A[i] + B[i] > x:
			print('No')
			break
	else:
		print('Yes')


import sys
import os
import math
import copy
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations, accumulate

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

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

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

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

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

def Hash():
	return dict()

def Mod():
	return 1000000007

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def watch(x):
	return print(x)

def common(l1, l2):
	return set(l1).intersection(l2)

def Most_frequent(list):
	return max(set(list), key=list.count)

def solution():
	for i in range(Int()):
		(n, x) = Mint()
		a = List()
		b = List()
		a = sorted(a, reverse=True)
		b.sort()
		f = 0
		for i in range(n):
			if a[i] + b[i] > x:
				f = 1
		if f == 0:
			print('Yes')
		else:
			print('No')
		s = Str()
solution()


for y in range(int(input())):
	t = input()
	if t == '':
		(n, m) = map(int, input().split())
	else:
		(n, m) = map(int, t.split())
	lst1 = list(map(int, input().split()))
	lst2 = list(map(int, input().split()))
	lst1.sort()
	lst2.sort(reverse=True)
	foo = 0
	for i in range(n):
		if lst1[i] + lst2[i] > m:
			foo = 1
	if foo == 0:
		print('Yes')
	else:
		print('No')


for t in range(int(input()) - 1):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = input()
	a.sort()
	b.sort()
	b = b[::-1]
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')
(n, x) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
b = b[::-1]
for i in range(n):
	if a[i] + b[i] > x:
		print('No')
		break
else:
	print('Yes')


t = int(input())
for x in range(t - 1):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	input()
	i = 0
	s = 'Yes'
	while i < n:
		if a[i] + b[n - 1 - i] > x:
			s = 'No'
			break
		i += 1
	print(s)
(n, x) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
i = 0
s = 'Yes'
while i < n:
	if a[i] + b[n - 1 - i] > x:
		s = 'No'
		break
	i += 1
print(s)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	i = 0
	j = n - 1
	f = 0
	while j >= 0 and i < n:
		if a[i] + b[j] > k:
			f = 1
		i += 1
		j -= 1
	if f:
		print('No')
	else:
		print('Yes')
	if t - 1:
		input()
		t -= 1


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())))
	b.reverse()
	for (i, j) in zip(a, b):
		if i + j > x:
			print('NO')
			break
	else:
		print('YES')
	try:
		s = input()
	except:
		pass


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


t = int(input())
for j in range(t):
	(n, x) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	if j < t - 1:
		input()
	for (y, z) in zip(a, b[::-1]):
		if y + z > x:
			print('No')
			break
	else:
		print('Yes')


class Solution:

	def __init__(self):
		self.found = -1
		self.pattern = []
		self.three = 0
		self.five = 0
		self.seven = 0

	@staticmethod
	def arrangePossible(n, x, a, b):
		a = sorted(a)
		b = sorted(b)[::-1]
		for (i, j) in zip(a, b):
			if i + j > x:
				return 'NO'
		return 'Yes'
num = int(input())
while num:
	if num == 1:
		no_of_lines = 3
	else:
		no_of_lines = 4
	lines = []
	for i in range(no_of_lines):
		lines.append(input())
	(n, x) = lines[0].split()
	a = list(map(int, lines[1].split()))
	b = list(map(int, lines[2].split()))
	val = Solution.arrangePossible(int(n), int(x), a, b)
	print(val)
	num -= 1


t = int(input())
for u in range(t):
	(n, x) = map(int, input().split())
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	if u < t - 1:
		tmp = input()
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('NO')
			break
	else:
		print('YES')


x = int(input())
for _ in range(x):
	(n, m) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	A.sort(reverse=True)
	B.sort(reverse=False)
	z = True
	for i in range(len(A)):
		if A[i] + B[i] > m:
			z = False
			break
	if z:
		print('Yes')
	else:
		print('No')
	if _ != x - 1:
		s = input()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l1.sort()
	l2.sort()
	l3 = l1[::-1]
	l4 = l2[::-1]
	m1 = 0
	m2 = 0
	for i in range(n):
		if l1[i] + l4[i] > k:
			m1 += 1
		if l2[i] + l3[i] > k:
			m2 += 1
	if m1 >= 1 and m2 >= 1:
		print('NO')
	else:
		print('YES')
	if _ < t - 1:
		s1 = input()


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

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

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def main():
	z = 0
	t = ii()
	for _ in range(2 * t - 1):
		z += 1
		if z % 2 == 0:
			input()
			continue
		else:
			(n, x) = mi()
			a = li()
			b = li()
			a = sorted(a)
			b = sorted(b)
			b = b[::-1]
			for i in range(n):
				if a[i] + b[i] > x:
					break
			else:
				print('YES')
				continue
			print('NO')
main()


n = int(input())
for j in range(n):
	(a, b) = map(int, input().split())
	c1 = sorted(list(map(int, input().split())))
	c2 = sorted(list(map(int, input().split())), reverse=True)
	if j < n - 1:
		d = input()
	f = 0
	for i in range(a):
		if c1[i] + c2[i] <= b:
			pass
		else:
			f = 1
			print('No')
			break
	if f == 0:
		print('Yes')


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.reverse()
	ans = 'Yes'
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 'No'
			break
	print(ans)
	if _ < t - 1:
		input()


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	ar1 = list(map(int, input().split()))
	ar2 = list(map(int, input().split()))
	ar2.sort(reverse=True)
	f = True
	for j in range(n):
		if ar1[j] + ar2[j] > x:
			f = False
	print('Yes' if f else 'No')
	if i < t - 1:
		input()


import sys
for i in range(int(input())):
	(n, x) = map(int, sys.stdin.readline().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	try:
		input()
	except:
		pass
	d = []
	a.sort()
	b.sort()
	b.reverse()
	for i in range(n):
		d.append(a[i] + b[i])
	count = 0
	for i in d:
		if i > x:
			print('No')
			count = 1
			break
	if count == 0:
		print('Yes')


t = int(input())
for i in range(t):
	if i != 0:
		input()
	(n, x) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()][::-1]
	flag = 0
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			flag = 1
			break
	if flag != 1:
		print('Yes')


test = int(input())
for i in range(test):
	(size, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b = b[::-1]
	if i != test - 1:
		z = input()
	flag = True
	for j in range(size):
		num1 = a[j]
		num2 = b[j]
		if num1 + num2 > x:
			print('No')
			flag = False
			break
	if flag == True:
		print('Yes')


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 main():
	numCases = inp()
	for i in range(numCases):
		lenAndx = inlt()
		len = lenAndx[0]
		x = lenAndx[1]
		listA = inlt()
		listB = inlt()
		canBe = True
		for i in range(len):
			if listA[i] + listB[len - i - 1] > x:
				canBe = False
				break
		if canBe:
			print('Yes')
		else:
			print('No')
		if i != numCases - 1:
			input()
main()


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b = sorted(b)
	b = b[::-1]
	ok = True
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			ok = False
			break
	if ok:
		print('Yes')
	if _ != t - 1:
		q = input()


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if i < t - 1:
		blank = input()
	a.sort()
	b.sort(reverse=True)
	message = 'Yes'
	for i in range(len(a)):
		if a[i] + b[i] > x:
			message = 'No'
			break
	print(message)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	vis = [0 for i in range(n)]
	flag = 0
	for i in range(n):
		ind = -1
		mv = -1
		for j in range(n):
			if vis[j] == 0 and A[i] + B[j] <= x:
				if B[j] > mv:
					mv = B[j]
					ind = j
		if ind == -1:
			flag = 1
			break
		vis[ind] = 1
	if flag == 0:
		print('Yes')
	else:
		print('No')
	a = input()


t = int(input())
flg = False
for i in range(t):
	if flg:
		sp = input()
	(s, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	flg = True
	a.sort()
	b.sort(reverse=True)
	d = 0
	for i in range(s):
		if a[i] + b[i] > x:
			d = 1
			break
	if d == 0:
		print('Yes')
	else:
		print('No')


t = int(input())
n = [0] * t
x = [0] * t
a = []
b = []
for i in range(t):
	k = input().split(' ')
	n[i] = int(k[0])
	x[i] = int(k[1])
	k = input().split(' ')
	a.append([])
	for z in k:
		a[i].append(int(z))
	k = input().split(' ')
	b.append([])
	for z in k:
		b[i].append(int(z))
	if i != t - 1:
		input()
for i in range(t):
	p = True
	a[i].sort()
	b[i].sort(reverse=True)
	for j in range(n[i]):
		if a[i][j] + b[i][j] > x[i]:
			p = False
			break
	if p:
		print('Yes')
	else:
		print('No')


t = int(input())
lst = []
for _ in range(t):
	flag = 0
	(n, l) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	a.sort(reverse=True)
	b.sort()
	for i in range(n):
		if a[i] + b[i] > l:
			lst.append('No')
			flag = 1
			break
	if flag == 0:
		lst.append('Yes')
	if _ != t - 1:
		input()
for i in lst:
	print(i)


t = int(input())
for T in range(t):
	[n, x] = list(map(int, input().split()))
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	B.reverse()
	if T != t - 1:
		input()
	for N in range(n):
		if A[N] + B[N] > x:
			print('No')
			break
	else:
		print('Yes')


a = int(input())
for x in range(a):
	(b, c) = map(int, input().split())
	p = list(map(int, input().split()))
	d = list(map(int, input().split()))
	if x != a - 1:
		e = input()
	p.sort()
	d.sort(reverse=True)
	j = 0
	for y in range(b):
		if p[y] + d[y] <= c:
			j += 1
		else:
			break
	if j == b:
		print('YES')
	else:
		print('NO')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	(n, x) = inp()
	a = list(inp())
	b = list(inp())
	c = ips()
	a.sort()
	b.sort(reverse=True)
	flag = True
	for i in range(n):
		if a[i] + b[i] <= x:
			pass
		else:
			flag = False
	if flag:
		out('Yes')
	else:
		out('No')


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

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

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	(n, x) = value()
	a = array()
	b = array()
	try:
		input()
	except:
		pass
	a.sort()
	b.sort(reverse=True)
	ok = 'Yes'
	for i in range(n):
		if a[i] + b[i] > x:
			ok = 'No'
	print(ok)


n = int(input())
for _ in range(n):
	(t, x) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	if _ < n - 1:
		blank = input()
	a.sort()
	b.sort(reverse=True)
	ans = ''
	for (j, k) in zip(a, b):
		if j + k > x:
			ans = 'No'
			break
		else:
			ans = 'Yes'
	print(ans)


t = int(input())
result = []
for i in range(t):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if i < t - 1:
		pul = input()
	a.sort(reverse=True)
	b.sort(reverse=False)
	for j in range(n):
		if a[j] + b[j] > x:
			result.append('No')
			break
		if j == n - 1:
			result.append('Yes')
for i in result:
	print(i)


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import queue
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input().strip()

def inin():
	return int(input())
for _ in range(inin()):
	if _ > 0:
		s = sin()
	(n, x) = cin()
	a = ain()
	b = ain()
	a.sort()
	b.sort(reverse=True)
	f = 1
	for i in range(n):
		if a[i] + b[i] > x:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for case in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort()
	a.sort(reverse=True)
	possible = True
	for i in range(n):
		if not a[i] + b[i] <= k:
			possible = False
			break
	if not possible:
		print('No')
	else:
		print('yes')
	if case == t - 1:
		exit()
	input()


ans = []
for st in range(int(input())):
	if st != 0:
		inp = input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=1)
	for i in range(n):
		if a[i] + b[i] > x:
			ans.append('NO')
			break
	else:
		ans.append('YES')
print('\n'.join(ans))


import sys, math, itertools, collections, copy
input = sys.stdin.readline

def solve():
	(n, x) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	line = input()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	solve()


tc = int(input())
for tc_idx in range(tc):
	(n, x) = map(int, input().split())
	(*a,) = map(int, input().split())
	(*b,) = map(int, input().split())
	a.sort()
	b.sort(reverse=True)
	res = True
	for (aa, bb) in zip(a, b):
		if aa + bb > x:
			res = False
			break
	print('Yes' if res else 'No')
	if tc_idx != tc - 1:
		_ = input()


a = int(input())
t = 0
for i in range(a):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	arr.sort()
	brr.sort(reverse=True)
	k = 0
	for i in range(0, len(arr)):
		if arr[i] + brr[i] > x:
			k = 1
			break
	if k == 1:
		print('No')
	else:
		print('Yes')
	if t == a - 1:
		break
	t = t + 1
	input()


t = int(input())
for ind in range(t):
	if ind != 0:
		input()
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.reverse()
	res = True
	for i in range(n):
		if a[i] + b[i] > x:
			res = False
			break
	if res:
		print('YES')
	else:
		print('NO')


import sys
stdin = sys.stdin
stdout = sys.stdout
inp = stdin.readlines()
t = int(inp[0])
L = 4
for i in range(t):
	args = inp[i * 4 + 1].split()
	n = int(args[0])
	x = int(args[1])
	a = [int(j) for j in inp[i * 4 + 2].split()]
	b = [int(k) for k in inp[i * 4 + 3].split()]
	A = sorted(a)
	B = sorted(b, reverse=True)
	res = False
	for l in range(n):
		if A[l] + B[l] > x:
			print('No')
			res = True
			break
	if not res:
		print('Yes')


import sys, math
input = sys.stdin.readline
t = int(input())
for r in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	blanl = input()
	for i in range(n):
		a[i] = x - a[i]
	a.sort()
	b.sort()
	ans = True
	for i in range(n):
		if b[i] > a[i]:
			ans = False
			break
	if ans == True:
		print('YES')
	else:
		print('NO')


def solve(a, b, x):
	j = len(a) - 1
	for i in a:
		if i + b[j] > x:
			return False
		j -= 1
	return True

def main():
	t = int(input())
	inp = list(map(int, input().split()))
	x = inp[1]
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if solve(a, b, x):
		print('YES')
	else:
		print('NO')
	t -= 1
	while t:
		input()
		inp = list(map(int, input().split()))
		x = inp[1]
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		if solve(a, b, x):
			print('YES')
		else:
			print('NO')
		t -= 1
main()


p = int(input())
for ctr in range(p):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if ctr != p - 1:
		input()
	a.sort()
	b.sort(reverse=1)
	for i in range(n):
		if a[i] + b[i] > k:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
g = 0
n = []
x = []
a = []
b = []
xx = int(0)
nn = int(0)
while t != 0:
	(nn, xx) = map(int, input().split())
	n.append(nn)
	x.append(xx)
	a.append(list(map(int, input().split())))
	b.append(list(map(int, input().split())))
	b[g].reverse()
	if t > 1:
		whiteLine = input()
	t -= 1
	g += 1
while g != 0:
	c = bool(False)
	for i in range(n[t]):
		if a[t][i] + b[t][i] > x[t]:
			c = False
			break
		else:
			c = True
	print('Yes') if c == True else print('No')
	g -= 1
	t += 1


def ans(A, B, n, x):
	for i in range(n):
		if A[i] + B[i] > x:
			return False
	return True
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	A = [int(i) for i in input().split()]
	B = [int(i) for i in input().split()]
	A.sort()
	B.sort(reverse=True)
	if ans(A, B, n, x):
		print('Yes')
	else:
		print('No')
	try:
		s = input()
	except:
		pass


t = int(input())
while t > 0:
	t -= 1
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.reverse()
	flag = True
	for (i, j) in zip(a, b):
		if i + j > x:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')
	if t > 0:
		line = input()


from sys import stdin, stdout
input = stdin.readline
print = lambda x: stdout.write(str(x) + '\n')
total = int(input())
for test in range(total):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b = b[::-1]
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')
	if test != total - 1:
		input()


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt, pi, ceil, log, inf, gcd
from itertools import permutations
from copy import deepcopy
from heapq import *
from sys import setrecursionlimit

def main():
	t = int(input())
	for j in range(t):
		(n, x) = map(int, input().split())
		a = sorted(map(int, input().split()))
		b = sorted(map(int, input().split()), reverse=True)
		if j != t - 1:
			input()
		ans = 'Yes'
		for i in range(n):
			if a[i] + b[i] > x:
				ans = 'No'
				break
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
import math

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

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

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(n, x) = get_ints()
	a = get_array()
	b = get_array()
	c = input()
	d = sorted(b)[::-1]
	flag = 0
	for i in range(n):
		if a[i] + d[i] > x:
			flag = 1
			break
	if flag == 1:
		print('No')
	else:
		print('Yes')


d = int(input())
for t in range(d):
	(n, k) = [int(i) for i in input().split()]
	lst1 = [int(i) for i in input().split()]
	lst2 = [int(i) for i in input().split()]
	lst1.sort(reverse=True)
	lst2.sort()
	nd = 0
	for i in range(0, n):
		if lst1[i] + lst2[i] > k:
			nd = 1
			break
	if t != d - 1:
		input()
	if nd:
		print('No')
	else:
		print('Yes')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	if _:
		input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	a1 = a[::-1]
	b1 = b[::-1]
	(c, c1) = (0, 0)
	for i in range(len(a)):
		if a[i] + b1[i] <= x:
			c += 1
		else:
			c += 0
	for i in range(len(b)):
		if b[i] + a1[i] <= x:
			c1 += 1
		else:
			c1 += 0
	if c == n or c1 == n:
		print('Yes')
	else:
		print('No')


def rearrange(n, x, a, b):
	a.sort(reverse=True)
	b.sort()
	for i in range(n):
		if a[i] + b[i] > x:
			return 'No'
	return 'Yes'
n = int(input())
res = []
for i in range(n):
	if i > 0:
		blank = input()
	num1 = list(map(int, input().split()))
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	res.append(rearrange(num1[0], num1[1], arr1, arr2))
for j in res:
	print(j)


import sys

def solve(a, b, q):
	a.sort(reverse=True)
	b.sort()
	for (x, y) in zip(a, b):
		if x + y > q:
			return 'No'
	return 'Yes'

def readinput():
	tc = int(sys.stdin.readline().strip())
	for r in range(tc):
		(n, x) = map(int, sys.stdin.readline().rstrip().split(' '))
		a = list(map(int, sys.stdin.readline().rstrip().split(' ')))
		b = list(map(int, sys.stdin.readline().rstrip().split(' ')))
		print(solve(a, b, x))
		if r != tc - 1:
			_ = sys.stdin.readline()
readinput()


T = int(input())
for _ in range(T):
	(n, x) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	ans = True
	for i in range(n):
		if b[i] + a[-i - 1] > x:
			ans = False
	if ans:
		print('Yes')
	else:
		print('No')
	if _ < T - 1:
		input()


def f():
	for i in range(b):
		if l[i] + q[b - i - 1] > c:
			return 1
	return 0
a = int(input())
for x in range(a):
	(b, c) = map(int, input().split())
	l = list(map(int, input().split()))
	q = list(map(int, input().split()))
	if f() == 0:
		print('Yes')
	else:
		print('No')
	if a - 1 > x:
		input()


try:
	t = int(input())
	for i in range(t):
		(n, k) = map(int, input().split())
		arr = list(map(int, input().split()))
		arr = sorted(arr)
		array = list(map(int, input().split()))
		array = sorted(array, reverse=True)
		s = []
		for i in range(n):
			s.append(arr[i] + array[i])
		if all((i <= k for i in s)):
			print('Yes')
		else:
			print('No')
		input()
except:
	pass


from collections import defaultdict as dd

def solve():
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))[::-1]
	ans = 'YES'
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 'NO'
			break
	print(ans)
t = int(input())
solve()
for _ in range(t - 1):
	input()
	solve()


t = int(input())
for j in range(t - 1):
	(n, x) = map(int, input().split())
	ch = input()
	a = ch.split()
	ch1 = input()
	b = ch1.split()
	c = input()
	for i in range(n):
		a[i] = int(a[i])
		b[i] = int(b[i])
	a.sort()
	b.sort()
	b.reverse()
	test = 'YES'
	for k in range(n):
		if a[k] + b[k] > x:
			test = 'NO'
			break
	print(test)
(n, x) = map(int, input().split())
ch = input()
a = ch.split()
ch1 = input()
b = ch1.split()
for i in range(n):
	a[i] = int(a[i])
	b[i] = int(b[i])
a.sort()
b.sort()
b.reverse()
test = 'YES'
for k in range(n):
	if a[k] + b[k] > x:
		test = 'NO'
		break
print(test)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

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

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

def ws(s):
	sys.stdout.write(s + '\n')

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = ri()
	for _ in range(tc):
		(n, x) = ria()
		a = ria()
		b = ria()
		z = rs()
		a = sorted(a)
		b = sorted(b)[::-1]
		ans = 'Yes'
		for i in range(n):
			if a[i] + b[i] > x:
				ans = 'No'
		print(ans)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	s1 = input()
	s2 = input()
	l1 = s1.split()
	l2 = s2.split()
	la = []
	lb = []
	c = True
	for j in range(a):
		la += [int(l1[j])]
		lb += [int(l2[j])]
	lb.reverse()
	if i != n - 1:
		r = input()
	for j in range(a):
		if la[j] + lb[j] > b:
			print('No')
			c = False
			break
	if c == True:
		print('Yes')


test = int(input())
for t in range(test):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	c = 1
	for i in range(n):
		if a[i] + b[i] > x:
			c = 0
			break
	print('YES' if c else 'NO')
	if t != test - 1:
		k = input()


from sys import stdin
input = stdin.readline

def A():
	t = int(input())
	for _ in range(t):
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		if _ != t - 1:
			input()
		b.sort(reverse=True)
		a.sort()
		truth = True
		for i in range(n):
			if a[i] + b[i] > x:
				truth = False
				break
		if truth:
			print('Yes')
		else:
			print('No')
A()


def is_rearrange(a, b, x):
	a.sort()
	b.sort()
	b = b[::-1]
	c = 0
	for i in range(len(a)):
		if a[i] + b[i] <= x:
			c += 1
	if c == len(a):
		return 'YES'
	return 'NO'
t = int(input())
for i in range(t):
	(n, x) = list(map(int, input().split()))
	if n > 1:
		a = [int(x) for x in input().split()]
		b = [int(x) for x in input().split()]
	else:
		a = [int(input())]
		b = [int(input())]
	if i != t - 1:
		s = input()
	print(is_rearrange(a, b, x))


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

def inplst():
	return list(map(int, input().split()))
t = int(input())
for s in range(t):
	k = False
	(n, x) = inpvar()
	a = inplst()
	b = inplst()
	if s != t - 1:
		input()
	a.sort()
	b.sort(reverse=True)
	for (i, j) in zip(a, b):
		if i + j > x:
			k = True
			break
	if k:
		print('No')
	else:
		print('Yes')


val = int(input())
for c in range(val):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	n = list(map(int, input().split()))
	if c < val - 1:
		waste = input()
	n.reverse()
	nb = 0
	for i in range(a):
		if l[i] + n[i] <= b:
			nb = i
			continue
		else:
			nb = i
			nb -= 1
			break
	if nb == a - 1:
		print('YES')
	else:
		print('NO')


import sys

def solve():
	(n, m) = map(int, input().split())
	la = [int(i) for i in input().split()]
	lb = [int(i) for i in input().split()]
	la.sort()
	lb.sort(reverse=1)
	for i in range(len(la)):
		if la[i] + lb[i] > m:
			print('No')
			return 0
	print('Yes')
while True:
	line = sys.stdin.readline()
	if not line:
		break
	for cas in range(int(line)):
		solve()
		line = sys.stdin.readline()


t = int(input())
while t:
	t -= 1
	(n, x) = map(int, input().split())
	first = list(map(int, input().split()))
	second = list(map(int, input().split()))
	first.sort()
	second.sort()
	possible = True
	mark = [True for i in range(n)]
	for i in range(n):
		element = first[n - i - 1]
		index = -1
		for j in range(n):
			if mark[j] and element + second[j] <= x:
				index = j
		if index == -1:
			possible = False
		else:
			mark[index] = False
	if possible:
		print('Yes')
	else:
		print('No')
	if t != 0:
		temp = input()


bt = int(input())
for q in range(bt):
	[n, x] = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = [0 for _ in range(n)]
	ph = 0
	for t in a:
		max = 0
		h = -1
		for i in range(n):
			if t + b[i] <= x and c[i] == 0 and (max < b[i]):
				max = b[i]
				h = i
		if h != -1:
			c[h] = 1
		else:
			print('No')
			ph = 1
			break
	if ph != 1:
		print('Yes')
	if q != bt - 1:
		input()


rn = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rns = lambda : map(int, input().split())
rs = lambda : input()
yn = lambda x: print('Yes') if x else print('No')
YN = lambda x: print('YES') if x else print('NO')
t = rn()
for _ in range(t):
	(n, x) = rns()
	a = rl()
	b = rl()
	if _ < t - 1:
		blank = input()
	a.sort()
	b.sort(reverse=True)
	ans = True
	for i in range(n):
		if a[i] + b[i] > x:
			ans = False
			break
	yn(ans)


import sys
from math import gcd, sqrt, ceil, log2
from collections import defaultdict, Counter, deque
from bisect import bisect_left, bisect_right
import math
sys.setrecursionlimit(2 * 10 ** 5 + 10)
import heapq
from itertools import permutations
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
aa = 'abcdefghijklmnopqrstuvwxyz'

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_sum(bit, i):
	s = 0
	i += 1
	while i > 0:
		s += bit[i]
		i -= i & -i
	return s

def update(bit, n, i, v):
	i += 1
	while i <= n:
		bit[i] += v
		i += i & -i

def modInverse(b, m):
	g = math.gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def primeFactors(n):
	sa = set()
	sa.add(n)
	while n % 2 == 0:
		sa.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			sa.add(i)
			n = n // i
	return sa

def seive(n):
	pri = [True] * (n + 1)
	p = 2
	while p * p <= n:
		if pri[p] == True:
			for i in range(p * p, n + 1, p):
				pri[i] = False
		p += 1
	return pri

def check_prim(n):
	if n < 0:
		return False
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def getZarr(string, z):
	n = len(string)
	(l, r, k) = (0, 0, 0)
	for i in range(1, n):
		if i > r:
			(l, r) = (i, i)
			while r < n and string[r - l] == string[r]:
				r += 1
			z[i] = r - l
			r -= 1
		else:
			k = i - l
			if z[k] < r - i + 1:
				z[i] = z[k]
			else:
				l = i
				while r < n and string[r - l] == string[r]:
					r += 1
				z[i] = r - l
				r -= 1

def search(text, pattern):
	concat = pattern + '$' + text
	l = len(concat)
	z = [0] * l
	getZarr(concat, z)
	ha = []
	for i in range(l):
		if z[i] == len(pattern):
			ha.append(i - len(pattern) - 1)
	return ha

def mergeIntervals(arr):
	arr.sort(key=lambda x: x[0])
	m = []
	s = -10000
	max = -100000
	for i in range(len(arr)):
		a = arr[i]
		if a[0] > max:
			if i != 0:
				m.append([s, max])
			max = a[1]
			s = a[0]
		elif a[1] >= max:
			max = a[1]
	if max != -100000 and [s, max] not in m:
		m.append([s, max])
	return m

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def sol(n):
	seti = set()
	for i in range(1, int(sqrt(n)) + 1):
		if n % i == 0:
			seti.add(n // i)
			seti.add(i)
	return seti

def lcm(a, b):
	return a * b // gcd(a, b)
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	la = [(a[i], i) for i in range(n)]
	la.sort()
	ans = [0] * n
	b.sort(reverse=True)
	flag = 0
	for i in range(n):
		(c, d) = la[i]
		if c + b[i] > x:
			flag = 1
			break
	if flag:
		print('No')
	else:
		print('Yes')
	if _ != t - 1:
		z = input()


for xx in range(int(input())):
	if xx >= 1:
		tmp = input()
	(n, x) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	l = []
	for i in range(n - 1, -1, -1):
		l.append(b[i])
	flag = 0
	for i in range(n):
		if a[i] + l[i] > x:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


def solve(a, b, n, x):
	for i in range(n):
		if a[i] + b[n - 1 - i] > x:
			return False
	return True
t = int(input())
for tt in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if tt < t - 1:
		input()
	if solve(a, b, n, x):
		print('Yes')
	else:
		print('No')


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	z = sorted(map(int, input().split()))
	z1 = sorted(map(int, input().split()))[::-1]
	if i != n - 1:
		input()
	ok = 1
	for i in range(a):
		if z[i] + z1[i] > b:
			ok = 0
	if ok:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math
import threading
import sys
import time

def get_int():
	return int(stdin.readline().strip())

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

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

def solve(t, T):
	(n, x) = get_tuple()
	a = get_list()
	b = get_list()
	if t != T:
		_ = input()
	a.sort()
	b.sort(reverse=True)
	visited = [False] * n
	ans = 'YES'
	for i in range(n):
		flag = False
		for i in range(n):
			if not visited[i] and a[i] + b[i] <= x:
				visited[i] = True
				flag = True
				break
		if not flag:
			ans = 'NO'
	print(ans)

def main(i, t):
	solve(i, t)
TestCases = True
if TestCases:
	t = get_int()
	for i in range(t):
		main(i + 1, t)
else:
	main()


t = int(input())

def main():
	(n, x) = tuple(map(int, input().split()))
	sp1 = sorted(list(map(int, input().split())), reverse=True)
	sp2 = sorted(list(map(int, input().split())))
	for i in range(n):
		if sp1[i] + sp2[i] > x:
			return 'No'
	return 'Yes'
for i in range(t):
	if i > 0:
		buffer = input()
	print(main())


n = int(input())
for ii in range(n):
	(m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	b.reverse()
	flag = True
	for i in range(m):
		flag = flag and a[i] + b[i] <= k
	if flag:
		print('Yes')
	else:
		print('No')
	if ii != n - 1:
		a = input()


f = lambda : list(map(int, input().split()))
s = f()[0]
for i in range(s):
	(n, x) = f()
	a = sorted(f())
	b = sorted(f())[::-1]
	l = [z + y for (z, y) in zip(a, b)]
	print('YNEOS'[max(l) > x::2])
	if i != s - 1:
		input()


t = int(input())
for k in range(t):
	data = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort(reverse=True)
	flag = True
	n = data[0]
	x = data[1]
	for i in range(len(a)):
		if a[i] + b[i] > x:
			flag = False
			print('No')
			break
	if flag:
		print('Yes')
	if k != t - 1:
		rand = input()


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for j in range(n):
		if a[j] + b[n - j - 1] > x:
			print('No')
			break
		if j == n - 1 and a[j] + b[n - j - 1] <= x:
			print('Yes')
	if i != t - 1:
		p1 = input()


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	n = len(a)
	a.sort(reverse=True)
	b.sort()

	def solve():
		for i in range(n):
			if a[i] + b[i] > x:
				return 'No'
		return 'Yes'
	result = solve()
	print(result)
	if j != t - 1:
		input()


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if i != t - 1:
		input()
	b = sorted(b, reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('NO')
			break
	else:
		print('YES')


for t in range(int(input())):
	(n, x) = map(int, input().split())
	arr1 = [int(x) for x in input().split()]
	arr2 = [int(x) for x in input().split()]
	try:
		input()
	except:
		pass
	flag = False
	for i in range(n):
		if arr1[i] + arr2[n - i - 1] > x:
			print('NO')
			flag = True
			break
	if flag == False:
		print('YES')


import sys
input = sys.stdin.readline

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def main():
	c = int(input())
	for _ in range(c):
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		a.sort()
		b.sort()
		b.reverse()
		f = 0
		for i in range(n):
			if a[i] + b[i] > x:
				f = 1
		if f:
			print('No')
		else:
			print('Yes')
		if _ < c - 1:
			s = input()
	return
main()


import sys
t = int(sys.stdin.readline())
for i in range(t):
	b = True
	(n, x) = map(int, sys.stdin.readline().split())
	a_lst = list(map(int, sys.stdin.readline().split()))
	b_lst = list(map(int, sys.stdin.readline().split()))
	a_lst = sorted(a_lst)
	b_lst = sorted(b_lst, reverse=True)
	for i in range(n):
		if a_lst[i] + b_lst[i] > x:
			b = False
			break
	if b:
		print('Yes')
	else:
		print('No')
	trash = sys.stdin.readline()


a = int(input())
for i in range(a):
	if i:
		s = input()
	(n, x) = map(int, input().split())
	z = list(map(int, input().split()))
	m = list(map(int, input().split()))
	z.sort()
	m.sort()
	t = m[::-1]
	flag = 0
	for i in range(len(z)):
		if z[i] + t[i] > x:
			flag = 1
			break
	if flag == 1:
		print('No')
	else:
		print('Yes')


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	if _ != t - 1:
		__ = input()
	A = sorted(A)
	B = sorted(B, reverse=True)
	for i in range(n):
		if A[i] + B[i] > x:
			print('NO')
			break
	else:
		print('YES')


nn = int(input())
for _ in range(int(nn)):
	(n, x) = list(map(int, input().split()))
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	arr1.sort()
	hammer = False
	arr2.sort(reverse=True)
	for k in range(n):
		if arr1[k] + arr2[k] > x:
			print('No')
			hammer = True
			break
	if not hammer:
		print('Yes')
	if _ != nn - 1:
		input()


def solve(a, b, x):
	for i in range(len(a)):
		if a[i] + b[i] <= x:
			continue
		else:
			return True
	return False
for _ in range(int(input())):
	if _ == 0:
		pass
	else:
		input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	b.reverse()
	if solve(a, b, x):
		print('No')
	else:
		print('Yes')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def prod(a, mod=10 ** 9 + 7):
	ans = 1
	for each in a:
		ans = ans * each % mod
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
q = int(input())
for _ in range(q if True else 1):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a = sorted(a)
	b = sorted(b)
	pos = True
	for i in range(n):
		if a[i] + b[-i - 1] <= x:
			continue
		else:
			pos = False
	print('YES' if pos else 'NO')
	if _ != q - 1:
		blank = input()


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	ls1 = [int(a) for a in input().split()]
	ls2 = [int(a) for a in input().split()]
	ls3 = []
	ls2.sort()
	for i in range(n):
		ls3.append(x - ls1[i])
	ls3.sort()
	p = 1
	for i in range(n):
		if ls2[i] > ls3[i]:
			p = 0
			print('NO')
			break
	if p:
		print('YES')
	if _ != t - 1:
		x1 = input()


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = sorted(map(int, input().split()))
	b = sorted(map(int, input().split()), reverse=True)
	ans = 'YES'
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 'NO'
			break
	print(ans)
	if _ < t - 1:
		k = input()


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('Yes')

def no():
	print('No')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

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

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main(o, O):
	try:
		(n, x) = In()
		a = list(In())
		b = list(In())
		if o != O - 1:
			extra = input()
		b.sort(reverse=True)
		flag = 0
		for i in range(n):
			if a[i] + b[i] > x:
				flag = 1
				break
		if flag:
			no()
		else:
			yes()
	except:
		pass
M = 998244353
P = 1000000007
O = I()
for o in range(O):
	main(o, O)


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a = sorted(a, reverse=True)
	b.sort()
	f = True
	for i in range(n):
		if a[i] + b[i] > x:
			f = False
			break
	if f:
		print('yes')
	else:
		print('no')
	if _ < t - 1:
		s = input()


def solve():
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	flag = 1
	for i in range(n):
		if a[i] + b[i] > x:
			flag = 0
			break
	if flag == 0:
		print('No')
	else:
		print('Yes')
	if j < t - 1:
		q = input()
t = int(input())
for j in range(t):
	solve()


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	flag = 0
	for i in range(n):
		if a[i] + b[i] > x:
			flag = 1
			break
	if flag == 1:
		print('No')
	else:
		print('Yes')
	if _ < t - 1:
		z = input()


t = int(input())
z = []
for i in range(t):
	c = 0
	(n, x) = map(int, input().split())
	a = [int(j) for j in input().split()]
	b = [int(j) for j in input().split()]
	b = b[::-1]
	for d in range(n):
		if a[d] + b[d] > x:
			c += 1
	if c > 0:
		z.append('No')
	else:
		z.append('Yes')
	if i < t - 1:
		m = input()
for i in range(len(z)):
	print(z[i])


testcases = int(input())
for i in range(testcases):
	(n, value) = [int(x) for x in input().split()]
	l1 = [int(x) for x in input().split()]
	l2 = [int(x) for x in input().split()]
	l2.reverse()
	flag = 0
	for j in range(n):
		if l1[j] + l2[j] > value:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')
	if i != testcases - 1:
		input()


def solve(arr1, arr2, x):
	for i in range(len(arr1)):
		if arr2[i] + arr1[i] > x:
			return 'No'
	return 'Yes'
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	arr_1 = list(map(int, input().split()))
	arr_2 = list(map(int, input().split()))
	arr_1.sort()
	arr_2.sort(reverse=True)
	print(solve(arr_1, arr_2, x))
	if _ < t - 1:
		input()


import sys
p = t = int(input())
while t:
	flag = True
	if p != t:
		input()
	(n, m) = map(int, input().split())
	a = list()
	b = list()
	tem_1 = input().split()
	tem_2 = input().split()
	for i in range(n):
		a.append(int(tem_1[i]))
		b.append(int(tem_2[i]))
	a.sort(reverse=False)
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > m:
			flag = False
			break
	if flag:
		print('Yes')
	else:
		print('No')
	t -= 1


t = int(input())
for q in range(t):
	(n, x) = map(int, input().split())
	arr1 = [int(i) for i in input().split()]
	arr2 = [int(j) for j in input().split()]
	if q != t - 1:
		p = input()
	arr2.reverse()
	b = True
	for k in range(n):
		if arr1[k] + arr2[k] > x:
			print('NO')
			b = False
			break
	if b == True:
		print('YES')


t = int(input())
for k in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort(reverse=True)
	found = False
	for i in range(n):
		if a[i] + b[i] > x:
			found = True
			break
	if found:
		print('No')
	else:
		print('Yes')
	if k != t - 1:
		trash = input()


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	(n, x) = R()
	a = sorted(R())
	b = sorted(R())
	if max([a[i] + b[-1 - i] for i in range(n)]) <= x:
		print('YES')
	else:
		print('NO')
	S()


t = int(input())
for c in range(t):
	(n, x) = input().split()
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	if c != t - 1:
		r = input() + '1'
	l1.sort()
	l2.sort(reverse=True)
	for y in range(int(n)):
		if l1[y] + l2[y] > int(x):
			print('No')
			break
	else:
		print('Yes')


import sys
import math
import heapq
from collections import deque
input = sys.stdin.readline

def solve():
	(n, z) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for (i, x) in enumerate(a):
		if x + b[-(i + 1)] > z:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(solve())
	input()


t = int(input())
for cnt in range(1, t + 1):
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	if cnt < t:
		bl = input()
	A.sort()
	B.sort(reverse=True)
	v = [False] * n
	tr = 0
	for a in A:
		for i in range(n):
			if a + B[i] <= x and v[i] == False:
				v[i] = True
				tr += 1
				break
	if tr == n:
		print('Yes')
	else:
		print('No')


N = int(input())
for T in range(N):
	(n, x) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	if T < N - 1:
		bl = input()
	a.sort()
	b.sort(reverse=True)
	ans = 'Yes'
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 'No'
			break
	print(ans)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if n == 1:
		if a[0] + b[0] <= x:
			print('Yes')
		else:
			print('No')
	else:
		tracker = False
		for j in range(n):
			if a[j] + b[n - j - 1] > x:
				tracker = True
				break
		if not tracker:
			print('Yes')
		else:
			print('No')
	if i != t - 1:
		s = input()


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.reverse()
	i = 0
	broke = False
	while i < n:
		if a[i] + b[i] > x:
			print('NO')
			broke = True
			break
		i += 1
	if not broke:
		print('YES')
	try:
		blank = input()
	except:
		pass


def solve(n, x, a, b):
	return all((a[i] + b[n - i - 1] <= x for i in range(n)))
tests = int(input())
for test in range(tests):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if test < tests - 1:
		_ = input()
	print('Yes' if solve(n, x, a, b) else 'No')


from sys import stdin
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	check = False
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			check = True
			break
	if check:
		print('NO')
	else:
		print('YES')
	xx = stdin.readline()


for _ in range(int(input())):
	if _ > 0:
		input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	a.reverse()
	b = list(map(int, input().split()))
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = sorted(map(int, input().split()))
	b = sorted(map(int, input().split()), reverse=True)
	con = True
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			con = False
			break
	if con:
		print('Yes')
	if _ != t - 1:
		input()


def main(a, b, x, l):
	for i in range(1, l + 1):
		if a[-i] + b[i - 1] > x:
			return 'No'
	return 'Yes'
t = int(input())
for i in range(t):
	(l, x) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	if i < t - 1:
		void = input()
	print(main(a, b, x, l))


t = int(input())
for _ in range(t):
	N = input()
	n = int(N.split()[0])
	x = int(N.split()[1])
	l1 = list(map(int, input().split()))
	l3 = list(map(int, input().split()))
	if _ < t - 1:
		z = input()
	k = 0
	l3.sort()
	l2 = l3[::-1]
	for i in range(n):
		if l1[i] + l2[i] > x:
			print('No')
			k += 1
			break
	if k == 0:
		print('Yes')


for _ in range(int(input())):
	if _ > 0:
		nul = input()
	(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())), reverse=True)
	cek = False
	for e in zip(a, b):
		if e[0] + e[1] > x:
			cek = True
	print('No' if cek else 'Yes')


for _ in range(int(input())):
	(m, maxn) = map(int, input().strip().split())
	l1 = list(map(int, input().strip().split()))
	l2 = list(map(int, input().strip().split()))
	l1.sort()
	l2.sort(reverse=True)
	c = [each + every for (each, every) in zip(l1, l2)]
	if max(c) > maxn:
		print('No')
	else:
		print('Yes')
	try:
		useless = input()
	except:
		pass


results = []

def solve():
	result = 'Yes'
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	b.reverse()
	for i in range(n):
		if a[i] + b[i] > x:
			result = 'No'
			break
	results.append(result)
numberOfTasks = int(input())
for i in range(numberOfTasks):
	if i != 0:
		input()
	solve()
for res in results:
	print(res)


t = int(input())
for i in range(t):
	(n, x) = input().split(' ')
	n = int(n)
	x = int(x)
	a = input().split(' ')
	b = input().split(' ')
	if i != t - 1:
		input()
	isYes = True
	for j in range(n):
		if not int(a[j]) + int(b[n - j - 1]) <= x:
			isYes = False
			break
	if isYes:
		print('Yes')
	else:
		print('No')


def specialfunc(a, b):
	for j in range(n):
		if a[j] + b[n - j - 1] > x:
			return 0
	return 1
val = input()
for i in list(range(int(val))):
	a1 = input().split()
	n = int(a1[0])
	x = int(a1[1])
	a2 = input()
	a2 = a2.split()
	a = list()
	for j in range(n):
		a.append(int(a2[j]))
	a3 = input().split()
	b = list()
	for j in range(n):
		b.append(int(a3[j]))
	a.sort()
	b.sort()
	if specialfunc(a, b) == 0:
		print('No')
	else:
		print('Yes')
	if i < int(val) - 1:
		a4 = input()


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

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

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in st()]
for _ in range(val()):
	(n, x) = li()
	a = sorted(li())
	b = sorted(li(), reverse=1)
	ans = 1
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 0
	print('YES' if ans else 'NO')
	__ = st()


count = int(input())
while count:
	s = 0
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	l1 = input().split()
	l2 = input().split()
	for i in range(a):
		l1[i] = int(l1[i])
		l2[i] = int(l2[i])
	l1.sort()
	l2.sort(reverse=True)
	for i in range(a):
		if l1[i] + l2[i] > b and s == 0:
			print('No')
			s = 1
	if s == 0:
		print('Yes')
	count -= 1
	if count > 0:
		space = input()


cases = int(input())
while cases:
	cases -= 1
	(a, b) = map(int, input().split())
	arr1 = sorted(list(map(int, input().split())))
	arr2 = sorted(list(map(int, input().split())), reverse=True)
	if cases > 0:
		blank = input()
	broken = False
	for (i, j) in zip(arr1, arr2):
		if i + j > b:
			broken = True
			break
	if broken:
		print('No')
	else:
		print('Yes')


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

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

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	return [[default for j in range(m)] for i in range(n)]

def arr3D(n, m, r, default=0):
	return [[[default for k in range(r)] for j in range(m)] for i in range(n)]

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

class DSU:

	def __init__(self, length):
		self.length = length
		self.parent = [-1] * self.length

	def getParent(self, node, start):
		if node >= self.length:
			return False
		if self.parent[node] < 0:
			if start != node:
				self.parent[start] = node
			return node
		return self.getParent(self.parent[node], start)

	def union(self, node1, node2):
		parent1 = self.getParent(node1, node1)
		parent2 = self.getParent(node2, node2)
		if parent1 == parent2:
			return False
		elif self.parent[parent1] <= self.parent[parent2]:
			self.parent[parent1] += self.parent[parent2]
			self.parent[parent2] = parent1
		else:
			self.parent[parent2] += self.parent[parent1]
			self.parent[parent1] = parent2
		return True

	def getCount(self, node):
		return -self.parent[self.getParent(node, node)]

def solve(n, x, a, b):
	a = sorted(a)
	b = sorted(b, reverse=1)
	for i in range(n):
		if a[i] + b[i] > x:
			return 'No'
	return 'Yes'
for _ in range(int(input())):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	input()
	print(solve(n, x, a, b))


t = int(input())
for i in range(t):
	c = input().split()
	n = int(c[0])
	x = int(c[1])
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	b.reverse()
	check = 0
	for l in range(n):
		if a[l] + b[l] > x:
			check += 1
			break
	if check > 0:
		print('NO')
	else:
		print('YES')
	if i != t - 1:
		e = input()


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

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

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 998244353
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	for _ in range(ii()):
		(n, x) = mi()
		a = li()
		b = li()
		s = si()
		a.sort()
		b.sort(reverse=True)
		f = 0
		for i in range(n):
			if a[i] + b[i] > x:
				f = 1
				break
		if f:
			print('No')
		else:
			print('Yes')
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


n = int(input())
for k in range(n):
	if k != 0:
		m = input()
	(x, y) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	b = b[::-1]
	c = 0
	for i in range(x):
		if a[i] + b[i] > y:
			print('No')
			break
		c = c + 1
	if c == x:
		print('Yes')


t = int(input())
while t > 0:
	t -= 1
	(n, x) = map(int, input().split())
	lst1 = list(map(int, input().split()))
	lst2 = list(map(int, input().split()))
	lst1.sort()
	lst2.sort()
	lst2.reverse()
	for i in range(n):
		lst1[i] += lst2[i]
	m = max(lst1)
	if m > x:
		print('No')
	else:
		print('Yes')
	if t != 0:
		input()


t = int(input())
i = 0
answers = []
while i < t:
	answer = 'Yes'
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	j = 0
	while j < n:
		if a[j] + b[j] > x:
			answer = 'No'
			break
		j += 1
	answers.append(answer)
	i += 1
	if i < t:
		input()
print(*answers)


import sys
input = sys.stdin.readline
for i in range(int(input())):
	(n, x) = map(int, input().split())
	a = sorted(map(int, input().split()))
	b = sorted(map(int, input().split()), reverse=True)
	if sum((aa + bb <= x for (aa, bb) in zip(a, b))) == n:
		print('Yes')
	else:
		print('No')
	input()


t = int(input())
answer = []
for i in range(t):
	f = input()
	(n, x) = map(int, f.split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.reverse()
	for j in a:
		if j + min(b) <= x:
			b.remove(min(b))
		else:
			answer.append('No')
			break
	else:
		answer.append('Yes')
	if i != t - 1:
		c = input()
for k in answer:
	print(k)


from collections import Counter
import string
import math
import sys
from fractions import Fraction

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

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def printDivisors(n):
	divisors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				divisors.append(i)
			else:
				divisors.extend((i, n // i))
		i = i + 1
	return divisors

def countTotalBits(num):
	binary = bin(num)[2:]
	return len(binary)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
tt = vary(1)
for tc in range(tt):
	(n, x) = vary(2)
	a = array_int()
	b = array_int()
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')
	if tc == tt - 1:
		break
	s = input()


for k in range(int(input())):
	if k > 0:
		s = input()
	(n, x) = list(map(int, input().strip().split()))
	a = list(map(int, input().strip().split()))
	b = list(map(int, input().strip().split()))
	flag = True
	for i in range(n):
		if a[i] + b[n - 1 - i] > x:
			flag = False
			break
	if flag:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	aa = sorted(a, reverse=True)
	ab = sorted(b)
	if _ < t - 1:
		em = list(map(int, input().split()))
	f = 0
	for i in range(x):
		if aa[i] + ab[i] > y:
			f = 1
			break
	aa = sorted(b, reverse=True)
	ab = sorted(a)
	for i in range(x):
		if aa[i] + ab[i] > y:
			f = 1
			break
	if f == 0:
		print('Yes')
	else:
		print('No')


te = int(input())
for j in range(te):
	(n, x) = [int(z) for z in input().split()]
	o = [int(z) for z in input().split()]
	t = [int(z) for z in input().split()]
	o.sort()
	t.sort(reverse=True)
	ans = []
	for i in range(n):
		ans.append(o[i] + t[i])
	if max(ans) <= x:
		print('Yes')
	else:
		print('No')
	if j <= te - 2:
		dum = input()


y = 0
p = 0
z = int(input())
for i in range(z):
	(n, x) = map(int, input().split(' '))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	p = p + 1
	if p != z:
		o = input()
	b.sort(reverse=True)
	for j in range(0, n):
		if a[j] + b[j] <= x:
			y = y + 1
	if y == n:
		print('Yes')
	else:
		print('No')
	y = 0


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


t = int(input())
for j in range(t):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	s = list(map(int, input().split()))
	if j + 1 < t:
		m = input()
	s.sort(reverse=True)
	c = 1
	for i in range(n):
		if l[i] + s[i] > x:
			c = 0
			break
	print('Yes' if c else 'No')


m = int(input())
l = []
for _ in range(m):
	(t, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())))[::-1]
	if _ != m - 1:
		c = input()
	for i in range(len(a)):
		if a[i] + b[i] > x:
			l.append('No')
			break
	else:
		l.append('Yes')
for i in l:
	print(i)


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split(' '))
	A = list(map(int, input().split(' ')))
	B = list(map(int, input().split(' ')))
	A.reverse()
	print('YES' if all((A[i] + B[i] <= x for i in range(n))) else 'NO')
	try:
		x = input()
	except EOFError:
		pass


t = int(input())
for i in range(t):
	(n, x) = list(map(int, input().split()))
	li = list(map(int, input().split()))[:n]
	li2 = list(map(int, input().split()))[:n]
	if i < t - 1:
		faltu = input()
	li.sort()
	li2.sort(reverse=True)
	f = True
	for j in range(n):
		if li[j] + li2[j] > x:
			f = False
			break
		else:
			f = True
	if f:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(0, t):
	l1 = [int(x) for x in input().split()]
	while l1 == []:
		l1 = [int(x) for x in input().split()]
	n = l1[0]
	x = l1[1]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	b.sort(reverse=True)
	matched = True
	for i in range(0, n):
		if a[i] + b[i] > x:
			print('No')
			matched = False
			break
	if matched == True:
		print('Yes')


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


import sys
from collections import deque
import math
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b = sorted(b, reverse=True)
	flag = True
	for j in range(len(a)):
		if a[j] + b[j] <= x:
			continue
		else:
			flag = False
			break
	if flag == True:
		print('Yes')
	else:
		print('No')
	s = input()


game = int(input())
for i in range(game):
	(n, x) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l1.sort()
	l2.sort()
	l2.reverse()
	count = 0
	if i < game - 1:
		o = input()
	for i in range(n):
		if l1[i] + l2[i] <= x:
			count += 1
		else:
			break
	if count == n:
		print('YES')
	else:
		print('NO')


T = int(input())
while T:
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b = b[::-1]
	mark = 0
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			mark = 1
			break
	if not mark:
		print('Yes')
	if T > 1:
		input()
	T -= 1


t = int(input())
for test in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort(reverse=True)
	result = True
	for i in range(n):
		if a[i] + b[i] > x:
			result = False
			break
	ans = 'Yes' if result else 'No'
	print(ans)
	if test < t - 1:
		input()


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


q = int(input())
for p in range(q):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))[::-1]
	if p != q - 1:
		z = input()
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	t = int(input())
	for _ in range(t):
		(n, x) = inar()
		a = inar()
		b = inar()
		take = input()
		a.sort()
		b.sort(reverse=True)
		ans = True
		for i in range(n):
			if a[i] + b[i] <= x:
				continue
			else:
				ans = False
				break
		if ans:
			print('Yes')
		else:
			print('No')
main()


t = int(input())
for k in range(t):
	(l, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	for i in range(l):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')
	if k != t - 1:
		input()


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	v = 'Yes'
	for i in range(n):
		if a[i] + b[i] > x:
			v = 'No'
			break
	print(v)
	if _ != t - 1:
		p = input()


from sys import stdin, stdout
(input, print) = (stdin.readline, stdout.write)

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

def pr_a(a):
	print(' '.join(list(map(str, a))))

def solve():
	(n, x) = read()
	a = read()
	b = read()
	if len(a) != len(b):
		print('No\n')
		return
	a.sort()
	b.sort()
	b.reverse()
	for i in range(len(a)):
		if a[i] + b[i] > x:
			print('No\n')
			return
	print('Yes\n')

def main():
	[t] = read()
	for _ in range(t):
		solve()
		read()
	return 0
main()


t = int(input().strip())
while t:
	(n, x) = map(int, input().strip().split())
	a = list(map(int, input().strip().split()))
	b = list(map(int, input().strip().split()))
	if t > 1:
		blank = input()
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')
	t -= 1


for _ in range(int(input())):
	inp = input().split()
	if inp:
		(n, x) = map(int, inp)
	else:
		(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())), reverse=True)
	ans = 'Yes'
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 'No'
	print(ans)


t = int(input())
while t > 0:
	(n, x) = [int(y) for y in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	if not t == 1:
		input()
	b = list(reversed(sorted(b)))
	res = True
	for k in range(n):
		if not a[k] + b[k] <= x:
			print('No')
			res = False
			break
	if res:
		print('Yes')
	t -= 1


import os
import sys
from io import BytesIO, IOBase

def main():
	t = int(input())
	for tc in range(t):
		if tc > 0:
			tab = input()
		line = input().split()
		(n, x) = (int(line[0]), int(line[1]))
		line1 = input().split()
		line2 = input().split()
		(a, b) = ([], [])
		for i in range(n):
			a.append(int(line1[i]))
			b.append(int(line2[i]))
		a.sort()
		b.sort(reverse=True)
		flag = 0
		for i in range(n):
			if a[i] + b[i] > x:
				print('No')
				flag = 1
				break
		if flag == 0:
			print('Yes')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys

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

def get_ints():
	return map(int, sys.stdin.readline().strip().split())
tests = int(input())
while tests != 0:
	inp = input()
	if inp.strip() == '':
		continue
	(size, limit) = [int(x) for x in inp.split()]
	p = get_list()
	q = get_list()
	for i in range(size):
		if p[i] + q[size - i - 1] > limit:
			print('No')
			break
	else:
		print('Yes')
	tests = tests - 1


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()

def main():
	for _ in range(int(I1())):
		(n, x) = I()
		a = list(I())
		b = list(I())
		f = 0
		for i in range(n):
			if a[i] + b[n - i - 1] > x:
				f = 1
				break
		if f == 1:
			print('NO')
		else:
			print('YES')
		s = I1()
main()


from math import *
from collections import deque
from copy import deepcopy
import sys

def inp():
	return sys.stdin.readline().rstrip('\r\n')

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

def strmulti():
	return map(str, inp().split())

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

def lcm(a, b):
	return a * b // gcd(a, b)

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def stringlis():
	return list(map(str, inp().split()))

def out(var):
	sys.stdout.write(str(var))

def printlist(a):
	print(' '.join((str(a[i]) for i in range(len(a)))))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
t = int(inp())
for _ in range(t):
	(n, x) = multi()
	a = lis()
	b = lis()
	b.sort(reverse=True)
	flag = False
	for i in range(n):
		if a[i] + b[i] > x:
			print('NO')
			flag = True
			break
	if not flag:
		print('YES')
	line = inp()


_ = int(input())
Ans = []
for i in range(_):
	(n, x) = map(int, input().split())
	s1 = sorted(list(map(int, input().split())))
	s2 = sorted(list(map(int, input().split())))[::-1]
	for pos in range(n):
		if s1[pos] + s2[pos] > x:
			break
	if s1[pos] + s2[pos] > x:
		Ans.append('No')
		if i + 1 < _:
			kur = input()
		continue
	else:
		Ans.append('Yes')
		if i + 1 < _:
			kur = input()
for _ in Ans:
	print(_)


q = int(input())
for _ in range(q):
	(n, x) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	f = 0
	for i in range(n):
		if l1[i] + l2[n - i - 1] > x:
			f = 1
			break
	if f:
		print('No')
	else:
		print('Yes')
	if _ < q - 1:
		t = input()


k = int(input())
for t in range(k):
	(n, x) = map(int, input().split())
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	arr1.sort()
	arr2.sort(reverse=True)
	ans = 'YES'
	for i in range(len(arr1)):
		if arr1[i] + arr2[i] > x:
			ans = 'NO'
			break
	print(ans)
	if t < k - 1:
		s = input()


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = [int(j) for j in input().split()]
	b = [int(j) for j in input().split()]
	a.sort
	b.sort()
	f = 0
	if i != t - 1:
		z = input()
	for j in range(n):
		if a[j] + b[n - j - 1] > x:
			f = 1
			print('No')
			break
	if f == 0:
		print('Yes')


nb_cases = int(input())
results = []

def solve(a, b, x):
	for (aa, bb) in zip(a, reversed(b)):
		if aa + bb > x:
			return 'No'
	return 'Yes'
for (i, case) in enumerate(range(nb_cases)):
	(n, x) = [int(e) for e in input().split()]
	a = [int(e) for e in input().split()]
	b = [int(e) for e in input().split()]
	results.append(solve(a, b, x))
	if i < nb_cases - 1:
		blank_line = input()
for r in results:
	print(r)


def reacomodo(x, lista_a, lista_b):
	for i in range(len(lista_a)):
		if lista_a[i] + lista_b[abs(i - len(lista_a) + 1)] > x:
			return 'No'
	return 'Yes'
test = int(input())
for i in range(test):
	(n, x) = map(int, input().split())
	lista_a = list(map(int, input().split()))
	lista_b = list(map(int, input().split()))
	print(reacomodo(x, lista_a, lista_b))
	if i == test - 1:
		pass
	else:
		input()


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	if all((i + j <= x for (i, j) in zip(a, b))):
		print('YES')
	else:
		print('NO')
	if i < t - 1:
		_ = input()


t = int(input())
for w in range(t):
	(n, x) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	a.sort()
	b.sort(reverse=True)
	flg = 0
	for i in range(n):
		if a[i] + b[i] <= x:
			continue
		else:
			flg = 1
			break
	if flg:
		print('No')
	else:
		print('Yes')
	if w == t - 1:
		continue
	else:
		p = input()


import sys
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def print(x):
	sys.stdout.write(str(x) + '\n')
t = int(input())
for i in range(t):
	if i != 0:
		n1 = input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	for (a1, b1) in zip(a, b):
		if a1 + b1 > x:
			print('NO')
			break
	else:
		print('YES')


for t in range(int(input())):
	if t > 0:
		input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.sort()
	s = sorted(enumerate(a), key=lambda x: x[1])
	ok = True
	for i in range(n):
		if s[i][1] + b[n - 1 - s[i][0]] > x:
			ok = False
			break
	print('Yes' if ok else 'No')


def alpha(n, x, a, b):
	a.sort()
	b.sort()
	b = b[::-1]
	for i in range(n):
		if a[i] + b[i] > x:
			return 'No'
	return 'Yes'
T = int(input())
for t in range(T):
	(n, x) = map(int, input().rstrip().split())
	a = list(map(int, input().rstrip().split()))
	b = list(map(int, input().rstrip().split()))
	print(alpha(n, x, a, b))
	if t != T - 1:
		input()


t = int(input())
while t:
	data = input().split()
	n = int(data[0])
	x = int(data[1])
	a = input().split()
	a = [int(item) for item in a]
	b = input().split()
	b = [int(item) for item in b]
	if t != 1:
		dummyData = input()
	a.sort()
	b.sort(reverse=True)
	valid = True
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			valid = False
			break
	if valid:
		print('Yes')
	t -= 1


col = int(input())
counterLen = 0
for i in range(col * 2 - 1):
	strinput = input()
	if strinput == '':
		continue
	(colLen, maxSumm) = list(map(int, strinput.split()))
	arrA = list(map(int, input().split()))
	arrB = list(map(int, input().split()))
	arrB = sorted(arrB)
	flag = True
	for k in range(len(arrA)):
		if not flag:
			break
		for j in range(len(arrB) - 1, -1, -1):
			flag = False
			if arrB[j] != 1000000:
				summ = arrA[k] + arrB[j]
				if summ <= maxSumm:
					arrB[j] = 1000000
					flag = True
					break
	if flag == True:
		print('Yes')
	else:
		print('No')


t = int(input())
q = t
for i in range(t):
	(l, k) = input().split()
	flag = 0
	l = int(l)
	l1 = list((int(num) for num in input().strip().split()))[:l]
	l2 = list((int(num) for num in input().strip().split()))[:l]
	l1.sort()
	l2.sort(reverse=True)
	for j in range(int(l)):
		if l1[j] + l2[j] > int(k):
			print('No')
			flag = 1
			break
	if flag is 0:
		print('Yes')
	q -= 1
	if q is not 0:
		o = input()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

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

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res) % MOD

def comb(n, x):
	(a, b) = (1, 1)
	for i in range(1, x + 1):
		a *= n + 1 - i
		b *= i
	return a // b % MOD

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	if y == 0:
		return 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

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

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

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
small = 'abcdefghijklmnopqrstuvwxyz'
large = small.upper()
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt
from decimal import Decimal

def solve(i):
	if i > 0:
		space = input()
	(n, x) = read()
	a = get_list()
	b = get_list()
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			return
	print('Yes')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = scanner()
for i in range(t):
	solve(i)


import math
t = int(input())
for i in range(t):
	if i != 0:
		input()
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	l = []
	f = 0
	for i in range(int(n)):
		l.append(a[i] + b[n - i - 1])
	for i in range(len(l)):
		if l[i] > x:
			print('No')
			f = 1
			break
	if f == 0:
		print('Yes')


n = input()
n = int(n)
for t in range(0, n):
	if t > 0:
		j = input()
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	arr = input()
	ar = list(map(int, arr.split(' ')))
	brr = input()
	br = list(map(int, brr.split(' ')))
	ar.sort()
	ban = 0
	ban = int(ban)
	br.sort(reverse=True)
	for i in range(0, a):
		if ar[i] + br[i] > b:
			print('No')
			ban = 1
			break
	if ban == 0:
		print('Yes')


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	arr2.reverse()
	for i in range(n):
		if arr1[i] + arr2[i] > x:
			print('No')
			break
	else:
		print('Yes')
	if _ != t - 1:
		input()


t = int(input())
for case in range(t):
	if case > 0:
		input()
	(n, x) = [int(s) for s in input().split(' ')]
	a = [int(s) for s in input().split(' ')]
	b = [int(s) for s in input().split(' ')]
	a.sort()
	b.sort(reverse=True)
	ans = 'Yes'
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 'No'
			break
	print(ans)


c = 1
t = int(input())
for i in range(t):
	(n, m) = list(map(int, input().split()))
	lst1 = list(map(int, input().split()))
	lst2 = list(map(int, input().split()))
	lst1.sort()
	lst2.sort(reverse=True)
	f = 0
	for i in range(n):
		if lst1[i] + lst2[i] > m:
			f = 1
			print('No')
			break
	if f == 0:
		print('Yes')
	if c < t:
		c += 1
		lst = input()


t = input()
for tt in range(int(t)):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	bo = True
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			bo = False
			break
	if bo:
		print('Yes')
	else:
		print('No')
	if tt != int(t) - 1:
		input()


testcases = int(input())
i = 1
while i <= testcases:
	booleans = True
	(n, x) = map(int, input().split(' '))
	lst1 = list(map(int, input().strip(' ').split(' ')))
	lst2 = list(map(int, input().strip(' ').split(' ')))
	while lst1 != []:
		if lst1[0] + lst2[-1] > x:
			print('No')
			booleans = False
			break
		else:
			lst1.pop(0)
			lst2.pop(-1)
	if booleans:
		print('Yes')
	if i != testcases:
		blank = input()
	i += 1


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = input().split()
	b = input().split()
	b = b[::-1]
	f = True
	for j in range(n):
		if int(a[j]) + int(b[j]) > x:
			f = False
			print('No')
			break
	if f:
		print('Yes')
	if i != t - 1:
		input()


from sys import stdin, stdout

def II():
	return int(stdin.readline())

def SI():
	return stdin.readline()[:-1]

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

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

def solve():
	(n, x) = MI()
	a = LI()
	b = LI()
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			stdout.write('No\n')
			return
	stdout.write('Yes\n')
t = II()
for i in range(t):
	solve()
	if i < t - 1:
		p = SI()


from sys import stdin
_input = stdin.readline
(_range, _sorted, _int) = (range, sorted, int)

def solution():
	for _ in _range(_int(_input())):
		(n, x) = [_int(i) for i in _input().split()]
		a = _sorted([_int(i) for i in _input().split()], reverse=True)
		b = _sorted([_int(i) for i in _input().split()])
		for i in _range(n):
			if a[i] + b[i] > x:
				print('No')
				break
		else:
			print('Yes')
		_input()
solution()


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	d = list(map(int, input().split()))
	if i != n - 1:
		input()
	d.sort(reverse=True)
	for i in range(a):
		if c[i] + d[i] > b:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
arr = []
for i in range(t):
	(n, x) = map(int, input().strip().split())
	a = input().strip().split()
	b = input().strip().split()
	if i != t - 1:
		input()
	p = 1
	for i in range(n):
		if int(a[i]) + int(b[-(i + 1)]) > x:
			p = 0
			arr.append('No')
			break
	if p == 1:
		arr.append('Yes')
for k in arr:
	print(k)


import math
from collections import deque
from sys import stdin, stdout, setrecursionlimit
from string import ascii_letters
letters = ascii_letters[:26]
from collections import defaultdict
input = stdin.readline
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())), reverse=True)
	print('Yes' if all([a[i] + b[i] <= x for i in range(n)]) else 'No')
	input()


import sys
t = int(input())
for test in range(t):
	[n, x] = list(map(int, input().split(' ')))
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	if test < t - 1:
		c = input()
	a.sort()
	b.sort(reverse=True)
	res = 'Yes'
	for i in range(n):
		if a[i] + b[i] > x:
			res = 'No'
	print(res)


import os
import sys
from io import BytesIO, IOBase
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 main():
	try:
		for _ in range(inp()):
			(n, x) = invr()
			a = inlt()
			b = sorted(inlt(), reverse=True)
			space = input()
			for i in range(n):
				if a[i] + b[i] > x:
					print('No')
					break
			else:
				print('Yes')
	except Exception as e:
		print(e)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
tot = []
lst = []
for i in range(t):
	ls = []
	ls1 = list(map(int, input().split(' ')))
	ls2 = list(map(int, input().split(' ')))
	ls3 = list(map(int, input().split(' ')))
	if i < t - 1:
		space = input()
	ls.append(ls1)
	ls.append(ls2)
	ls.append(ls3)
	tot.append(ls)
for j in range(t):
	for k in range(tot[j][0][0]):
		if tot[j][1][k] + tot[j][2][tot[j][0][0] - k - 1] <= tot[j][0][1]:
			count = 1
		else:
			count = 0
			break
	if count == 1:
		lst.append('Yes')
	else:
		lst.append('No')
print('\n'.join(lst))


from functools import reduce
import collections
import math
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	t = Read.int()
	for q in range(t):
		(n, x) = Read.list_int()
		a = sorted(Read.list_int())
		b = sorted(Read.list_int())[::-1]
		flag = True
		c = 0
		while flag and c < n:
			if a[c] + b[c] > x:
				flag = False
			c += 1
		if flag:
			print('Yes')
		else:
			print('No')
		if q != t - 1:
			Read.string()
main()


n = int(input())
for _ in range(n):
	(k, x) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	a.sort(reverse=True)
	ok = True
	for i in range(k):
		if a[i] + b[i] > x:
			print('NO')
			ok = False
			break
	if ok:
		print('YES')
	if _ != n - 1:
		dumbassbih = input()


def main():
	t = int(input())
	for i in range(t):
		(n, x) = list(map(int, input().split(' ')))
		a = sorted(list(map(int, input().split(' '))))
		b = sorted(list(map(int, input().split(' '))), reverse=True)
		if i != t - 1:
			input()
		print('No' if any(map(lambda y, z: y + z > x, a, b)) else 'Yes')
main()


def can_rearrange(a, b, x, n):
	for idx in range(n):
		if a[idx] + b[n - 1 - idx] > x:
			return 'No'
	return 'Yes'
T = int(input())
for t in range(T):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if t < T - 1:
		input()
	print(can_rearrange(a, b, x, n))


T = int(input())
for tc in range(T):
	flag = 0
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	if tc != T - 1:
		input()
	for i in range(n):
		if a[i] + b[i] <= x:
			flag = 1
		else:
			flag = 0
			break
	if flag == 1:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	a = sorted(a)
	b = list(map(int, input().split()))
	b = sorted(b, reverse=True)
	if all((s + t <= x for (s, t) in zip(a, b))):
		print('Yes')
	else:
		print('No')
	if _ < t - 1:
		input()


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	b = list(reversed(sorted(list(map(int, input().split())))))
	ans = 'Yes'
	for j in range(n):
		if a[j] + b[j] > x:
			ans = 'No'
			break
	print(ans)
	if i != t - 1:
		input()


import math

def power(x, y):
	res = 1
	while y > 0:
		if y & 1:
			res = res * x
		y = y >> 1
		x = x * x
	return res
t = int(input())
for tt in range(t):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	if tt != t - 1:
		s = input()
	arr.sort(reverse=True)
	brr.sort()
	flag = True
	for i in range(len(arr)):
		if arr[i] + brr[i] > x:
			flag = False
			break
	if flag:
		print('Yes')
	else:
		print('No')


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	d = list(map(int, input().split()))
	c.reverse()
	d.sort()
	j = 0
	for _ in range(a):
		if c[_] + d[_] > b:
			j = 1
	if j == 1:
		print('NO')
	else:
		print('YES')
	t = t - 1
	if t > 0:
		c = input()


tests = int(input())
while tests != 0:
	inp = input()
	a = inp.split()
	if len(a) == 0:
		continue
	(size, limit) = [int(x) for x in inp.split()]
	p = input()
	list1 = [int(x) for x in p.split()]
	q = input()
	list2 = [int(x) for x in q.split()]
	for i in range(size):
		if list1[i] + list2[size - i - 1] > limit:
			print('No')
			break
	else:
		print('Yes')
	tests = tests - 1


for _ in range(int(input())):
	asd = input()
	if not asd:
		asd = input()
	(n, x) = map(int, asd.split())
	a = sorted(map(int, input().split()))
	b = sorted(map(int, input().split()), reverse=True)
	if not all((a[i] + b[i] <= x for i in range(n))):
		print('No')
	else:
		print('Yes')


l = int(input())
for m in range(l):
	(n, k) = map(int, input().split())
	x = list(map(int, input().split()))
	y = list(map(int, input().split()))
	for i in range(n):
		if x[i] + y[n - 1 - i] <= k:
			continue
		else:
			print('No')
			break
	else:
		print('Yes')
	if m != l - 1:
		input()


def read_array():
	x = []
	x1 = []
	x = input()
	x = x.split(' ')
	for r in range(len(x)):
		x1.append(int(x[r]))
	return x1

def can_be_bigger(x, y, z):
	while len(x) != 0 or len(y) != 0:
		if max(x) + min(y) > z:
			return 'No'
		else:
			x.pop(x.index(max(x)))
			y.pop(y.index(min(y)))
	return 'Yes'
res = []
m = int(input())
for i in range(m):
	z = read_array()[1]
	x = read_array()
	y = read_array()
	if i == m - 1:
		pass
	else:
		input()
	res.append(can_be_bigger(x, y, z))
for u in res:
	print(u)


def read_generator():
	while True:
		tokens = input().split(' ')
		for t in tokens:
			yield t
reader = read_generator()

def readword():
	return next(reader)

def readint():
	return int(next(reader))

def readfloat():
	return float(next(reader))

def readline():
	return input()

def solve(a, b, n):
	for i in range(n):
		if a[i] + b[i] > x:
			return 'No'
	return 'Yes'
tests = readint()
for t in range(tests):
	(n, x) = (readint(), readint())
	a = sorted([readint() for _ in range(n)])
	b = list(reversed(sorted([readint() for _ in range(n)])))
	print(solve(a, b, n))
	if t + 1 < tests:
		readline()


t = int(input())
for i in range(0, t):
	count = 0
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.reverse()
	for j in range(0, n):
		ab = a[j] + b[j]
		if ab < x or ab == x:
			count += 1
		else:
			break
	if count == n:
		print('Yes')
	else:
		print('No')
	if i != t - 1:
		zero = input()


from sys import stdin
input = stdin.readline

def solve():
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	if all((l + r <= x for (l, r) in zip(a, b))):
		print('Yes')
	else:
		print('No')
t = int(input())
for _ in range(t):
	solve()
	input()


def read_ints():
	return map(int, input().split())
t = int(input())
for i_t in range(t):
	(n, x) = read_ints()
	a = sorted(read_ints())
	b = sorted(read_ints(), reverse=True)
	if max((a_i + b_i for (a_i, b_i) in zip(a, b))) <= x:
		output = 'Yes'
	else:
		output = 'No'
	print(output)
	if i_t + 1 != t:
		input()


def ab(a, b, x):
	n = len(a)
	i1 = 0
	i2 = n - 1
	while i1 < n:
		if a[i1] + b[i2] > x:
			return False
		i1 += 1
		i2 -= 1
	return True
t = int(input())
for _ in range(t - 1):
	(xx, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = input()
	if ab(a, b, x):
		print('YES')
	else:
		print('NO')
(xx, x) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if ab(a, b, x):
	print('YES')
else:
	print('NO')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	ar = list(map(int, input().split()))
	br = list(map(int, input().split()))
	br = br[::-1]
	flag = 0
	for i in range(n):
		if ar[i] + br[i] > x:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')
	try:
		xxx = input()
	except:
		do = 1


tt = int(input())
arrow = []
while tt > 0:
	w = input()
	w = w.split()
	n = int(w[0])
	x = int(w[1])
	a = input()
	b = input()
	a = a.split()
	b = b.split()
	a = list(map(int, a))
	b = list(map(int, b))
	a.sort()
	b.sort(reverse=True)
	k = 0
	ans = 'No'
	for i in range(n):
		if a[i] + b[i] > x:
			k += 1
			break
	if k == 0:
		ans = 'Yes'
	arrow.append(ans)
	tt -= 1
	if tt != 0:
		r = input()
for i in range(len(arrow)):
	print(arrow[i])


for lov in range(int(input())):
	if lov >= 1:
		az = input()
	a = list(input().split())
	m = int(a[0])
	n = int(a[1])
	l = list(map(int, input().split()))
	b = list(map(int, input().split()))
	l.sort()
	flag = False
	b.sort(reverse=True)
	for i in range(m):
		if l[i] + b[i] > n:
			flag = True
			break
	if flag:
		print('No')
	else:
		print('Yes')


test = int(input())
for t in range(test):
	(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	b = sorted(list(map(int, input().split())), reverse=True)
	if t < test - 1:
		raw = input()
	ans = 'YES'
	for (i, j) in zip(a, b):
		if i + j > x:
			ans = 'NO'
			break
	print(ans)


import sys
input = sys.stdin.readline
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input()
for _ in range(ri()):
	(n, x) = rl()
	a = rl()
	b = rl()
	temp = b.copy()
	ans = 'Yes'
	for i in range(n):
		re = 0
		for j in range(len(temp)):
			if a[i] + temp[j] <= x:
				re = max(re, temp[j])
		if not re:
			ans = 'No'
			break
		temp.remove(re)
	print('%s' % ans)
	x = rs()


t = int(input())
for i in range(t):
	if i > 0:
		s = input().strip()
	(n, k) = map(int, input().strip().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	f = 0
	for j in range(n):
		if a[j] + b[j] > k:
			f = 1
	if f == 0:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	if i != 0:
		s = input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.reverse()
	for i in range(n):
		k = a[i] + b[i]
		if k > x:
			print('NO')
			break
	else:
		print('YES')


def panda(n, la, lb, x):
	if n == 1:
		if la[0] + lb[0] > x:
			return 'No'
		return 'Yes'
	a = sorted(la)
	b = sorted(lb)[::-1]
	for i in range(n):
		if a[i] + b[i] > x:
			return 'No'
	else:
		return 'Yes'
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	la = list(map(int, input().split()))
	lb = list(map(int, input().split()))
	print(panda(n, la, lb, x))
	if _ != t - 1:
		s = input()


import math
for _ in range(int(input())):
	if _ == 0:
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
	else:
		c = input()
		(n, x) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
	b.sort()
	a.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			break
	else:
		print('Yes')


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

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

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

def invr():
	return map(int, input().split())
n = inp()
for _ in range(n):
	l = inlt()
	length = l[0]
	x = l[1]
	a = inlt()
	b = inlt()
	b.reverse()
	flag = 1
	for i in range(length):
		if a[i] + b[i] > x:
			flag = 0
	if flag:
		print('YES')
	else:
		print('NO')
	if _ != n - 1:
		s = insr()


t = int(input())
answerlist = []
resultlist = []
for i in range(t - 1):
	(n, x) = map(int, input().split())
	xlist = [x]
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	space = input()
	a = sorted(a)
	b = sorted(b, reverse=True)
	for i in range(len(a)):
		if a[i] + b[i] > x:
			answerlist.append('No')
			break
	else:
		answerlist.append('Yes')
(n, x) = map(int, input().split())
xlist = [x]
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = sorted(a)
b = sorted(b, reverse=True)
for i in range(len(a)):
	if a[i] + b[i] > x:
		answerlist.append('No')
		break
else:
	answerlist.append('Yes')
print('\n'.join(answerlist))


from math import *
from bisect import *
from collections import *
from random import *
from decimal import *
from itertools import *
from heapq import *
import sys
input = sys.stdin.readline

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

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

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

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	(n, x) = ma()
	a = lis()
	b = lis()
	a.sort()
	b.sort()
	fl = 0
	s = 'YES'
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			fl = 1
			break
	if fl:
		s = 'NO'
	print(s)
	f = st()


import sys
input = sys.stdin.readline
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input()
for _ in range(ri()):
	(n, x) = rl()
	a = rl()
	b = rl()
	ans = 'Yes'
	a.sort(reverse=True)
	b.sort()
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 'No'
			break
	print('%s' % ans)
	x = rs()


from sys import *
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	A.reverse()
	f = 1
	for i in range(n):
		if A[i] + B[i] > m:
			f = 0
	if f == 1:
		stdout.write(str('Yes') + '\n')
	else:
		stdout.write(str('No') + '\n')
	stdin.readline()


t = int(input())
for p in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().strip().split()))
	b = list(map(int, input().strip().split()))
	flag = 0
	a.sort()
	b.sort()
	b.reverse()
	ans = ''
	for i in range(n):
		if a[i] + b[i] > x:
			ans = 'NO'
			break
		else:
			ans = 'YES'
	print(ans)
	if p < t - 1:
		space = input()


import sys, os
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

def solve_(arr, brr, k):
	brr = sorted(brr)
	arr = sorted(arr)[::-1]
	for (a, b) in zip(arr, brr):
		if a + b > k:
			return 'No'
	return 'Yes'

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	pass
ONLINE_JUDGE = False
if os.path.exists('input.txt'):
	ONLINE_JUDGE = True
if ONLINE_JUDGE:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def console(*args):
		pass

def solve(*args):
	if not ONLINE_JUDGE:
		console('----- solving ------')
		console(*args)
		console('----- ------- ------')
	return solve_(*args)
if True:
	inp = iter(sys.stdin.buffer.readlines())
	input = lambda : next(inp)
else:
	input = sys.stdin.buffer.readline
total_cases = int(input())
for case_num in range(total_cases):
	(_, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	res = solve(arr, brr, k)
	print(res)
	if total_cases - 1 == case_num:
		break
	_ = input()


t = int(input())
mas = []
for k in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if k != t - 1:
		s = input()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] <= x:
			if i == n - 1:
				mas.append('Yes')
		else:
			mas.append('No')
			break
for i in range(t):
	print(mas[i])


for _ in [0] * (int(input()) - 1):
	(n, x) = map(int, input().split())
	a = sorted(map(int, input().split()))
	b = sorted(map(int, input().split()))[::-1]
	f = True
	for i in range(n):
		if a[i] + b[i] > x:
			f = False
			break
	print('yes' if f else 'no')
	input()
(n, x) = map(int, input().split())
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))[::-1]
f = True
for i in range(n):
	if a[i] + b[i] > x:
		f = False
		break
print('yes' if f else 'no')


T = int(input())
while T > 0:
	(n, x) = map(int, input().split())
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	if T > 1:
		input()
	arr1.sort()
	arr2.sort(reverse=True)
	res = True
	for i in range(n):
		if arr1[i] + arr2[i] > x:
			res = False
			break
	if res is True:
		print('YES')
	else:
		print('NO')
	T -= 1


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	a.sort()
	b.sort()
	dem = n - 1
	ok = 1
	for nn in a:
		if nn + b[dem] > x:
			ok = 0
			break
		dem -= 1
	print(['No', 'Yes'][ok])
	if _ < t - 1:
		input()


for _ in range(int(input())):
	g = list(map(int, input().split()))
	if g == []:
		(n, x) = map(int, input().split())
		l = list(map(int, input().split()))
		a = list(map(int, input().split()))
		a = a[::-1]
		f = 0
		for i in range(n):
			if l[i] + a[i] > x:
				f = 1
				break
		if f == 1:
			print('No')
		else:
			print('Yes')
	else:
		(n, x) = (g[0], g[1])
		l = list(map(int, input().split()))
		a = list(map(int, input().split()))
		a = a[::-1]
		f = 0
		for i in range(n):
			if l[i] + a[i] > x:
				f = 1
				break
		if f == 1:
			print('No')
		else:
			print('Yes')


t = int(input())
for i in range(0, t):
	(n, x) = map(int, input().split())
	flag = 0
	a = list(map(int, input().strip().split(' ')))
	b = list(map(int, input().strip().split(' ')))
	if i < t - 1:
		blank_line = input()
	for i in range(n):
		if a[i] + b[n - i - 1] > x:
			flag = 1
			print('No')
			break
	if flag == 0:
		print('Yes')


t = int(input())
while t:
	t -= 1
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	for (ai, bi) in zip(a, b):
		if ai + bi > x:
			print('No')
			break
	else:
		print('Yes')
	try:
		_ = input()
	except:
		pass


t = int(input())
for i in range(t):
	(n, m) = [int(j) for j in input().split()]
	a = sorted([int(j) for j in input().split()])
	b = sorted([int(j) for j in input().split()])
	output = 'Yes'
	pointer = n - 1
	for j in range(n):
		if a[j] + b[pointer] <= m:
			pointer -= 1
		else:
			output = 'No'
			break
	print(output)
	if i != t - 1:
		input()


for _ in range(int(input())):
	if _ != 0:
		t = input()
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	b.reverse()
	f = 0
	for i in range(n):
		if a[i] + b[i] > q:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	ar = list(map(int, input().split()))
	br = list(map(int, input().split()))
	ar.sort()
	br.sort(reverse=True)
	flag = True
	for i in range(n):
		if ar[i] + br[i] > x:
			flag = False
			break
	if flag:
		print('Yes')
	else:
		print('No')
	if _ != t - 1:
		xx = input()


for _ in range(int(input())):
	if _ > 0:
		blankspace = input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(m1, m2, M1, M2) = (min(a), min(b), max(a), max(b))
	if M1 >= x or M2 >= x:
		print('No')
	else:
		b.sort(reverse=True)
		for i in range(n):
			if a[i] + b[i] <= x:
				continue
			else:
				print('No')
				break
		else:
			print('Yes')


def readGenerator():
	while True:
		tokens = input().split(' ')
		for t in tokens:
			yield t
reader = readGenerator()

def readWord():
	return next(reader)

def readInt():
	return int(next(reader))

def readFloat():
	return float(next(reader))

def readLine():
	return input()

def solve(n, x, a, b):
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			return 'No'
	return 'Yes'
t = readInt()
for i in range(t):
	n = readInt()
	x = readInt()
	a = [readInt() for _ in range(n)]
	b = [readInt() for _ in range(n)]
	print(solve(n, x, a, b))
	if i < t - 1:
		readLine()


t = int(input())
for testcase in range(t):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	arr.sort(reverse=True)
	brr.sort()
	break_applied = False
	for i in range(n):
		if arr[i] + brr[i] > x:
			print('NO')
			break_applied = True
			break
	if not break_applied:
		print('YES')
	if testcase < t - 1:
		input()


t = int(input())
for case in range(t):
	(n, x) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b.reverse()
	can = True
	for ele in range(n):
		if a[ele] + b[ele] > x:
			can = False
			break
	if can:
		print('Yes')
	else:
		print('No')
	if case != t - 1:
		x = input()


p = int(input())
for w in range(p):
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	d = list(map(int, input().split()))
	q = 0
	for i in range(a):
		if c[i] + d[a - 1 - i] > b:
			q = 1
	if q == 0:
		print('Yes')
	if q == 1:
		print('No')
	if w != p - 1:
		w = input()


import sys
input = sys.stdin.readline
tests = int(input())
for test in range(tests):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for step in range(n):
		if a[step] + b[-(step + 1)] > x:
			print('No')
			break
	else:
		print('Yes')
	blankrad = input()


t = int(input())
for q in range(t):
	(n, x) = map(int, input().split())
	mass = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	if q != t - 1:
		input()
	mass.sort()
	arr.sort(reverse=True)
	f = True
	for i in range(n):
		if mass[i] + arr[i] > x:
			f = False
			break
	if f:
		print('Yes')
	else:
		print('No')


def ok(a, b, x):
	for i in range(len(a)):
		if a[i] + b[i] > x:
			return 'No'
	return 'Yes'
t = int(input())
c = []
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	c.append(ok(a, b, x))
	if i != t - 1:
		input()
for x in c:
	print(x)


import sys
input = sys.stdin.buffer.readline

def solution(test):
	if test > 0:
		x = input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	for i in range(n):
		if a[i] + b[i] > x:
			print('NO')
			return
	print('YES')
t = int(input())
for _ in range(t):
	solution(_)


f = int(input())
g = f - 1
for _ in range(f):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	b.sort(reverse=True)
	c = 0
	for i in range(n):
		if a[i] + b[i] > k:
			c = 1
			break
	if c == 1:
		print('No')
	else:
		print('Yes')
	if g:
		s = str(input())
	g -= 1


t = int(input())
R = lambda : map(int, input().split())
for _ in range(t):
	(n, x) = R()
	a = list(R())
	b = list(R())
	for (i, j) in zip(sorted(a), sorted(b, reverse=True)):
		if i + j > x:
			print('No')
			break
	else:
		print('Yes')
	if _ < t - 1:
		input()


import sys
from math import *
from fractions import *

def main():
	(n, x) = map(int, sys.stdin.readline().split())
	q = list(map(int, sys.stdin.readline().split()))
	w = list(map(int, sys.stdin.readline().split()))
	print('YES' if n == sum([q[i] + w[n - i - 1] <= x for i in range(n)]) else 'NO')
for i in range(int(input()) - 1):
	main()
	input()
main()


for i in range(int(input())):
	if i > 0:
		input()
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a = sorted(a)
	b = sorted(b)
	b = b[::-1]
	y = 0
	for i in range(n):
		if a[i] + b[i] <= x:
			y = y + 1
	if y == n:
		print('YES')
	else:
		print('NO')


def solve():
	m = 0
	(n, x) = [int(j) for j in input().split()]
	a = [int(мурк) for мурк in input().split()]
	b = [int(k) for k in input().split()]
	b.reverse()
	for j in range(n):
		if a[j] + b[j] <= x:
			m = m + 1
		else:
			m = -9999999999999999999
	if m > 0:
		print('YES')
	else:
		print('NO')

def cmp(key):
	return key[0]
from math import floor, ceil
t = int(input())
for i in range(t - 1):
	solve()
	input()
solve()


import functools, math, collections, itertools

def foo(A, B, x):
	for i in range(len(A)):
		if A[i] + B[i] > x:
			return 'No'
	return 'Yes'
t = int(input())
for k in range(t):
	(n, x) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	if k < t - 1:
		input()
	A.sort()
	B.sort(reverse=1)
	print(foo(A, B, x))


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))[::-1]
	b = sorted(list(map(int, input().split())))
	y = 0
	for i in range(n):
		if a[i] + b[i] > x:
			print('No')
			y = 1
			break
	if y == 0:
		print('Yes')
	if _ != t - 1:
		s = input()


n = int(input())
for _ in range(n - 1):
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	a.sort()
	b.sort()
	b.reverse()
	flag = False
	for i in range(n):
		if a[i] + b[i] > k:
			flag = True
			break
	if flag:
		print('No')
	else:
		print('Yes')
	input()
(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
b.sort()
b.reverse()
flag = False
for i in range(n):
	if a[i] + b[i] > k:
		flag = True
		break
if flag:
	print('No')
else:
	print('Yes')


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input().split()))
t = int(input())
for j in range(t):
	(n, x) = I()
	a = I()
	b = I()
	a = sorted(a, reverse=True)
	b = sorted(b)
	count = 0
	for i in range(n):
		if a[i] + b[i] <= x:
			pass
		else:
			count = 1
			break
	if count == 1:
		print('No')
	else:
		print('Yes')
	if j != t - 1:
		c = str(input())