Read problems statements in Mandarin chinese, Russian and Vietnamese as well. 

You are given a sequence $A_{1}, A_{2}, \dots, A_{N}$ of positive integers and an integer $K$. You are allowed to perform the following operation any number of times (including zero):
choose an index $j$ between $1$ and $N$ inclusive
choose a positive divisor $d$ of $A_{j}$ such that $d ≤ K$
divide $A_{j}$ by $d$

Determine if it is possible to modify the sequence $A$ in such a way that it would satisfy the following condition: there is no positive integer strictly greater than $1$ which divides every element of $A$. (In other words, the greatest common divisor of all elements of $A$ should be $1$.)

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

------  Output ------
For each test case, print a single line containing the string "YES" if it is possible to make the GCD of all elements of $A$ equal to $1$ or "NO" if it is impossible.

------  Constraints  ------
$1 ≤ T ≤ 10$
$1 ≤ N ≤ 10^{5}$
$1 ≤ A_{i} ≤ 10^{9}$ for each valid $i$
$1 ≤ K ≤ 10^{9}$ 

------  Subtasks ------
Subtask #1 (30 points):
$1 ≤ N, K ≤ 100$
$1 ≤ A_{i} ≤ 100$ for each valid $i$

Subtask #2 (70 points): original constraints

----- Sample Input 1 ------ 
2

3 6

10 15 30

3 4

5 10 20
----- Sample Output 1 ------ 
YES

NO

Difficulty: MEDIUM_HARD

Solutions:
from functools import reduce

def pfs(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i != 0:
			i += 1
		else:
			while n % i == 0:
				n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return factors

def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	g = reduce(gcd, a)
	if len(pfs(g)) == 0:
		print('YES')
	elif max(pfs(g)) > k:
		print('NO')
	else:
		print('YES')


import numpy as np

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

def gcd_arr(arr, size):
	result = arr[0]
	for i in range(1, size):
		result = gcd(result, arr[i])
	return result
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	gcdArray = gcd_arr(arr, n)
	prime_max = 1
	i = 2
	while i < gcdArray ** 0.5:
		while gcdArray % i == 0:
			gcdArray /= i
			prime_max = max(prime_max, i)
		i += 1
	prime_max = max(prime_max, gcdArray)
	if prime_max < k + 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		g = gcd(l[0], l[1])
		for j in range(2, n):
			g = gcd(g, l[j])
	if g == 1:
		print('YES')
	else:
		a = []
		z = 2
		while z * z <= g:
			if g % z == 0:
				while g % z == 0:
					a.append(z)
					g //= z
			z += 1
		if g > 1:
			a.append(g)
		m = max(a)
		print('YES' if m <= k else 'NO')


import math

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

def getGCD(num):
	if len(num) == 2:
		return gcd(num[0], num[1])
	if len(num) == 1:
		return num[0]
	left = getGCD(num[:len(num) // 2])
	right = getGCD(num[len(num) // 2:])
	return gcd(left, right)

def largestprime(n):
	maxprime = 1
	for i in range(2, int(math.sqrt(n)) + 1):
		while n % i == 0:
			n = n // i
			maxprime = max(maxprime, i)
	return maxprime
for _ in range(int(input())):
	(n, k) = input().split()
	num = [int(i) for i in input().split()]
	if len(num) == 1:
		print('YES')
	else:
		gcdNum = getGCD(num)
		if gcdNum <= int(k):
			print('YES')
		elif largestprime(gcdNum) == 1:
			print('NO')
		elif largestprime(gcdNum) <= int(k):
			print('YES')
		else:
			print('NO')


from math import *

def maxPrimeFactors(n, k):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	while n % 3 == 0:
		maxPrime = 3
		n = n / 3
	if maxPrime > k:
		return False
	for i in range(5, int(sqrt(n)) + 1, 6):
		while n % i == 0:
			maxPrime = i
			n = n / i
		if maxPrime > k:
			return False
		while n % (i + 2) == 0:
			maxPrime = i + 2
			n = n / (i + 2)
			if maxPrime > k:
				return False
	if n > 4:
		maxPrime = n
	if maxPrime > k:
		return False
	return True
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	g = a[0]
	for i in range(1, n):
		g = gcd(a[i], g)
	if maxPrimeFactors(g, k):
		print('YES')
	else:
		print('NO')


import math

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

def factor(n):
	mmax = 1
	cp = n
	if cp % 2 == 0:
		mmax = 2
	while cp % 2 == 0:
		cp /= 2
	for i in range(3, int(math.sqrt(cp)), 2):
		if cp % i == 0:
			mmax = i
		while cp % i == 0:
			cp /= i
	if cp > 2:
		return int(cp)
	else:
		return int(mmax)

def solve(ar, k):
	hcf = ar[0]
	for n in ar[1:]:
		hcf = gcd(n, hcf)
	if factor(hcf) <= k:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	(_, k) = (int(i) for i in input().split())
	ar = [int(i) for i in input().split()]
	solve(ar, k)


import math

def gcdMeth(a, b):
	if b == 0:
		return a
	return gcdMeth(b, a % b)

def possibleCoPrimeArray(n, k, lst):
	g = lst[0]
	ans = 1
	for i in range(1, n):
		g = gcdMeth(g, lst[i])
	if n == 1:
		return 'YES'
	elif g == 1:
		return 'YES'
	else:
		for i in range(2, int(math.sqrt(g) + 1)):
			while g % i == 0:
				g /= i
				ans = max(ans, i)
		ans = max(ans, g)
		if ans <= k:
			return 'YES'
	return 'NO'

def main():
	for i in range(int(input().strip())):
		(n, k) = map(int, input().strip().split(' '))
		lst = list(map(int, input().strip().split(' ')))
		print('{0}'.format(possibleCoPrimeArray(n, k, lst)))
main()


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = int(input())
for _ in range(t):
	(c, k) = map(int, input().split())
	a = list(map(int, input().split()))
	g = a[0]
	for i in range(1, len(a)):
		g = gcd(g, a[i])
	if len(a) == 1:
		print('YES')
	elif g == 1:
		print('YES')
	else:
		i = 2
		max_num = 0
		while i * i < g:
			if g % i == 0:
				while g % i == 0:
					g = g // i
					max_num = max(max_num, i)
			i += 1
		max_num = max(max_num, g)
		if max_num <= k:
			print('YES')
		else:
			print('NO')


from math import sqrt, gcd
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	a = l[0]
	b = l[1]
	g = gcd(a, b)
	m = 1
	for i in range(2, n):
		g = gcd(g, l[i])
		if g == 1:
			break
	for i in range(2, int(sqrt(g)) + 1):
		while g % i == 0:
			g = g // i
			m = max(i, m)
	print('YES') if max(m, g) <= k else print('NO')


from math import gcd, sqrt

def primeFactors(n):
	pf = []
	while n % 2 == 0:
		n = n // 2
		pf.append(2)
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			n = n // i
			pf.append(i)
	if n > 2:
		pf.append(n)
	return pf
T = int(input())
ans = []
for _ in range(T):
	(N, K) = [int(i) for i in input().split()]
	A = [int(i) for i in input().split()]
	g = A[0]
	for i in range(1, N):
		g = gcd(A[i], g)
	x = primeFactors(g)
	for i in x:
		if i > K:
			ans.append('NO')
			break
	else:
		ans.append('YES')
for i in ans:
	print(i)


import math

def _factor(n):
	r = 1
	i = 2
	while i * i <= n:
		if n % i == 0:
			r = i
			while n % i == 0:
				n = n / i
		i += 1
	if n != 1:
		r = n
	return r

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

def Solution(arr, n, m):
	g = 0
	for i in range(len(arr)):
		g = gcd(g, arr[i])
	if g == 1:
		return 'YES'
	ft = _factor(g)
	if ft <= m:
		return 'YES'
	return 'NO'
for t in range(int(input())):
	(N, M) = map(int, input().split())
	arr = list(map(int, input().split()))
	print(Solution(arr, N, M))


import math

def gcd(a, b):
	while a % b != 0:
		(a, b) = (b, a % b)
	return b
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	g = arr[0]
	i = 1
	while i < n:
		g = gcd(arr[i], g)
		i += 1
	if g <= k:
		print('YES')
	else:
		i = 2
		while i <= int(math.sqrt(g)) and g != 1:
			if i > k:
				break
			elif g % i == 0:
				g = g // i
			else:
				i += 1
		if g > k:
			print('NO')
		else:
			print('YES')


import sys
input = sys.stdin.readline

def gcd(x, y):
	if x % y == 0:
		return y
	return gcd(y, x % y)
t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	k = int(l[1])
	l = input().split()
	li = [int(i) for i in l]
	g = li[0]
	for i in li:
		g = gcd(g, i)
	if g == 1:
		print('YES')
		continue
	l = []
	i = 2
	while i * i <= g:
		if g % i == 0:
			l.append(i)
			while g % i == 0:
				g = g // i
		i += 1
	if g != 1:
		l.append(g)
	poss = 1
	for i in l:
		if i > k:
			poss = 0
			break
	if poss:
		print('YES')
	else:
		print('NO')


def gcd(x, y):
	if x > y:
		(x, y) = (x, y)
	else:
		(x, y) = (y, x)
	while y != 0:
		a = x
		x = y
		y = a % y
	return x
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = [int(x) for x in input().split()]
	primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
	i = 1
	m = arr[0]
	while i < len(arr):
		m = gcd(m, arr[i])
		i += 1
	loli = 0
	while primes[loli] <= m:
		if primes[loli] > k or m == 1:
			break
		if m % primes[loli] == 0:
			m //= primes[loli]
		if m % primes[loli] != 0:
			loli += 1
		if m % primes[loli] != 0 and loli == 167:
			break
	if m == 1:
		print('YES')
	else:
		print('NO')


from math import gcd
from math import sqrt

def primeFactors(n, k):
	flag = 1
	while n % 2 == 0:
		if k < 2:
			flag = 0
			break
		n = n / 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			if i > k:
				flag = 0
				break
			n = n / i
		if flag == 0:
			break
	if n > 2:
		if n > k:
			flag = 0
	if flag == 0:
		print('NO')
	else:
		print('YES')
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	g = gcd(l[0], l[1])
	for i in range(2, n):
		g = gcd(g, l[i])
	primeFactors(g, k)


import math

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

def gcdarray(l):
	x = l[0]
	for i in range(len(l)):
		x = math.gcd(x, l[i])
	return x
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	array = list(map(int, input().split()))
	gc = gcdarray(array)
	maximum = primeFactors(gc)
	if maximum <= k:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	hcf = a[0]
	max_prime = 1
	for i in range(1, n):
		hcf = math.gcd(a[i], hcf)
	for j in range(2, int(math.sqrt(hcf))):
		while hcf % j == 0:
			hcf /= j
			max_prime = max(max_prime, j)
	max_prime = max(max_prime, hcf)
	if max_prime <= k:
		print('YES')
	else:
		print('NO')


import math

def fun(n):
	maxi = -1
	while n % 2 == 0:
		maxi = 2
		n /= 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxi = i
			n = n / i
	if n > 2:
		maxi = n
	return int(maxi)
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	hak = a[0]
	for i in range(1, n):
		hak = math.gcd(hak, a[i])
		if hak == 1:
			break
	hak = fun(hak)
	if hak <= k:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if a % b == 0:
		return b
	return gcd(b, a % b)
t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	k = int(l[1])
	l = input().split()
	li = [int(i) for i in l]
	gcdo = li[0]
	for i in li:
		gcdo = gcd(gcdo, i)
	if gcdo == 1:
		print('YES')
	else:
		lfi = []
		i = 2
		while i * i <= gcdo:
			if gcdo % i == 0:
				lfi.append(i)
				while gcdo % i == 0:
					gcdo = gcdo // i
			i += 1
		if gcdo != 1:
			lfi.append(gcdo)
		if lfi == [] or max(lfi) <= k:
			print('YES')
		else:
			print('NO')


import math as m

def max_prime_fact(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n /= 2
	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 maxPrime
for _ in range(int(input())):
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))
	a = A[0]
	for j in range(1, len(A)):
		x = m.gcd(a, A[j])
		a = x
	Max = max_prime_fact(a)
	if Max > K:
		print('NO')
	else:
		print('YES')


def gcd(a, b):
	if a % b == 0:
		return b
	elif b % a == 0:
		return a
	elif a > b:
		return gcd(b, a % b)
	elif b > a:
		return gcd(a, b % a)
t = int(input())
for z in range(t):
	inp = list(map(int, input().split()))
	n = inp[0]
	k = inp[1]
	inp = list(map(int, input().split()))
	g = inp[0]
	for c in range(1, len(inp)):
		g = gcd(g, inp[c])
	if g == 1:
		print('YES')
	else:
		l = gcd(g, k)
		while l != 1:
			while g % l == 0:
				g = g // l
			l = gcd(g, k)
		if g <= k:
			print('YES')
		else:
			print('NO')


import functools
import math
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	g = functools.reduce(math.gcd, l)
	if g <= m:
		print('YES')
	elif math.gcd(g, m) == 1:
		print('NO')
	else:
		print('YES')


import math
t = int(input())

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

def gcd(l):
	x = l[0]
	for i in range(len(l)):
		x = math.gcd(x, l[i])
	return x
for ii in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	l = input().split()
	for i in range(len(l)):
		l[i] = int(l[i])
	if maxPrimeFactors(gcd(l)) <= k:
		print('YES')
	else:
		print('NO')


import math

def gcdd(a):
	x = 0
	for i in a:
		x = math.gcd(x, i)
	return x
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	y = gcdd(a)
	if y <= k:
		print('YES')
	else:
		while y % 2 == 0 and k != 1:
			y = y // 2
		for i in range(3, min(k + 1, int(y ** 0.5) + 1), 2):
			if i > y or y == 1:
				break
			while y % i == 0:
				y = y // i
		if y == 1:
			print('YES')
		else:
			print('NO')


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	gcd = math.gcd(a[0], a[1])
	for i in range(2, n):
		gcd = math.gcd(gcd, a[i])
	res = 0
	for i in range(2, int(math.sqrt(gcd)) + 1):
		while gcd % i == 0:
			gcd /= i
			res = max(i, res)
	res = max(gcd, res)
	if res > k:
		print('NO')
	else:
		print('YES')


import math

def prime(r):
	abc = 1
	for i in range(2, int(math.sqrt(r)) + 1):
		while r % i == 0:
			r /= i
			abc = max(abc, i)
	return max(abc, r)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	r = l[0]
	for i in l:
		r = math.gcd(r, i)
	x = prime(r)
	if x <= k:
		print('YES')
	else:
		print('NO')


import math

def fact(gcd, k):
	prfact = 1
	for i in range(2, int(math.sqrt(gcd))):
		while gcd % i == 0:
			gcd /= i
			prfact = max(prfact, i)
	prfact = max(prfact, gcd)
	print('YES' if prfact <= k else 'NO')
	return
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ar = list(map(int, input().split()))
	gcd = ar[0]
	for i in ar:
		gcd = math.gcd(gcd, i)
	fact(gcd, k)


from math import gcd
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	it = list(map(int, input().split()))
	g = it[0]
	for i in it[1:]:
		g = gcd(g, i)
	if k >= g:
		g = 1
	else:
		while g % 2 == 0 and k >= 2:
			g = g // 2
		for i in range(3, min(k + 1, int(g ** 0.5) + 1), 2):
			if g == 1 or i > g:
				break
			while g % i == 0:
				g = g // i
	if g != 1:
		print('NO')
	else:
		print('YES')


import math
from math import gcd

def primeFactors(n):
	la = []
	while n % 2 == 0:
		la.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			la.append(i)
			n = n // i
	if n > 2:
		la.append(n)
	return la
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	k1 = 0
	for i in l:
		k1 = gcd(i, k1)
	if k1 <= k:
		print('YES')
	else:
		z = primeFactors(k1)
		flag = 0
		for i in z:
			if i > k:
				flag = 1
				break
		if flag == 0:
			print('YES')
		else:
			print('NO')


import math

def f(p):
	ma = 1
	for i in range(2, int(math.sqrt(p)) + 1):
		while p % i == 0:
			p //= i
			ma = max(ma, i)
	ma = max(ma, p)
	return ma
R = lambda : map(int, input().split())
for _ in range(int(input())):
	(n, k) = R()
	L = list(R())
	g = L[0]
	for i in range(1, n):
		g = math.gcd(g, L[i])
	if f(g) <= k:
		print('YES')
	else:
		print('NO')


def largest_prime_factors(n):
	s = set()
	limit = int(n ** 0.5) + 2
	for i in range(2, limit):
		while n % i == 0:
			n = n // i
			s.add(i)
	if n:
		s.add(n)
	return max(s)
from math import gcd

def fun():
	test = int(input())
	for t in range(test):
		(n, k) = map(int, input().split())
		arr = list(map(int, input().split()))
		g = arr[0]
		for i in arr:
			g = gcd(g, i)
		pf = largest_prime_factors(g)
		if pf > k:
			print('NO')
		else:
			print('YES')
fun()


from math import *
from functools import *

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	GCD = reduce(gcd, l)
	if GCD == 1 or GCD <= k:
		print('YES')
	else:
		print('YES' if maxPrimeFactors(GCD) <= k else 'NO')


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	res = 'YES'
	gcd_all = min(c)
	d = 0
	if gcd_all == 1:
		print('YES')
	else:
		store = -1
		if gcd_all % 2 == 0:
			store = 2
		while gcd_all % 2 == 0:
			gcd_all = gcd_all // 2
		for i in range(3, int(math.sqrt(gcd_all)) + 1, 2):
			if i > gcd_all:
				break
			if gcd_all % i == 0:
				store = i
			while gcd_all % i == 0:
				gcd_all = gcd_all // i
		if store == -1 and gcd_all > b:
			print('NO')
		elif store <= b:
			print('YES')
		else:
			print('NO')


from math import gcd
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	g = l[0]
	for i in range(1, n):
		g = gcd(g, l[i])
	x = 1
	for i in range(2, int(g ** 0.5) + 1):
		while g % i == 0:
			g //= i
			x = max(x, i)
	x = max(x, g)
	if x <= k:
		print('YES')
	else:
		print('NO')


import math

def primeFactors(n):
	l = []
	if n % 2 == 0:
		l += [2]
	while n % 2 == 0:
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		if n % i == 0:
			l += [i]
		while n % i == 0:
			n = n / i
	if n > 2:
		l += [n]
	return l
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	gc = l[0]
	for i in range(1, n):
		gc = math.gcd(gc, l[i])
	l1 = primeFactors(gc)
	fl = 1
	for x in l1:
		if x > k:
			fl = 0
	if fl == 1:
		print('YES')
	else:
		print('NO')


from math import sqrt as S
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = [int(i) for i in input().split()]

	def gcd(a, b):
		return a if b == 0 else gcd(b, a % b)
	g = l[0]
	for i in range(1, n):
		g = gcd(g, l[i])
	maxip = 0
	for i in range(2, int(S(g))):
		if g % i == 0:
			maxip = max(maxip, i)
			while g % i == 0:
				g //= i
	if g > 1:
		maxip = max(maxip, g)
	print('YES' if maxip <= k else 'NO')


from math import sqrt

def cal_gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
tc = int(input())
for _ in range(tc):
	(n, k) = map(int, input().strip().split(' '))
	arr = list(map(int, input().strip().split(' ')))
	t1 = arr[0]
	t2 = arr[1]
	gcd = cal_gcd(t1, t2)
	for i in range(2, n):
		gcd = cal_gcd(gcd, arr[i])
	flag = True
	r = int(sqrt(gcd))
	for i in range(2, r):
		while gcd % i == 0:
			if i > k:
				flag = False
			gcd //= i
	if gcd > k:
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
t = int(input())
while t > 0:
	t -= 1
	(n, k) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	if n == 1:
		print('NO')
		exit()
	while True:
		a = A[0]
		for ele in A[1:]:
			a = gcd(a, ele)
		if a == 1:
			print('YES')
			break
		elif a > k:
			if a % 2 == 0:
				if k == 1:
					print('NO')
					break
				while a > k:
					a = a // 2
				for i in range(n):
					A[i] = A[i] // a
			else:
				print('NO')
				break
		else:
			for i in range(n):
				A[i] = A[i] // a


from math import gcd
t = int(input())
while t:
	t -= 1
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	hcf = a[0]
	for i in a[1:]:
		hcf = gcd(hcf, i)
	f = 1
	while hcf > 1:
		divisor = 2
		noDivisor = True
		while divisor * divisor <= hcf:
			if hcf % divisor == 0:
				noDivisor = False
				if divisor > k:
					f = 0
				hcf //= divisor
				break
			divisor += 1
		if f == 0 or noDivisor:
			break
	if f and hcf <= k:
		print('YES')
	else:
		print('NO')


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	x = a[0]
	for i in range(1, n):
		x = math.gcd(x, a[i])
	if k > 1:
		while True:
			if x % 2 == 0:
				x //= 2
			else:
				break
	for i in range(3, int(math.sqrt(x) + 2), 2):
		while x % i == 0 and i <= k:
			x //= i
		if i >= k:
			break
	if n == 1:
		if a[0] == 1:
			print('YES')
		else:
			print('NO')
	elif x <= k:
		print('YES')
	else:
		print('NO')


def prime_factors(n):
	ans_list = set()
	while n > 0:
		limit = int(pow(n, 0.5)) + 1
		for i in range(2, limit):
			if n % i == 0:
				n = n // i
				ans_list.add(i)
				break
		else:
			ans_list.add(n)
			break
	return ans_list
from math import gcd
test = int(input())
for i in range(test):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	g = arr[0]
	for i in range(1, n):
		g = gcd(g, arr[i])
	pf_list = prime_factors(g)
	m = max(pf_list)
	if m <= k:
		print('YES')
	else:
		print('NO')


from math import gcd

def primeFactor(num):
	res = []
	i = 2
	while i * i <= num:
		if num % i == 0:
			res.append(i)
			num //= i
		else:
			i += 1
	if num > 1:
		res.append(num)
	return res
t = int(input())
for h in range(t):
	(n, k) = map(int, input().split())
	array = list(map(int, input().split()))
	g = array[0]
	for i in range(1, n):
		g = gcd(g, array[i])
	if g <= k:
		print('YES')
	else:
		flag = primeFactor(g)
		if max(flag) > k:
			print('NO')
		else:
			print('YES')


import math

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

def maxPrimeFactors2(n):
	maxPrime = -1
	if n == 1:
		return 1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(k, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	ar = list(map(int, input().split()))
	b = True
	for elem in ar:
		if n <= 100 and k <= 100:
			maxPrimeFact = maxPrimeFactors1(elem)
		else:
			maxPrimeFact = maxPrimeFactors2(elem)
		if maxPrimeFact > k:
			b = False
			break
	if b == True:
		print('YES')
	else:
		print('NO')


from math import gcd

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

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

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

def primeFactor(n):
	A = []
	i = 2
	while i * i <= n:
		if n % i == 0:
			A.append(i)
			n //= i
		else:
			i += 1
	if n > 1:
		A.append(n)
	return A
for i in range(ii()):
	(n, k) = mi()
	A = li()
	g = A[0]
	for i in range(1, n):
		g = gcd(g, A[i])
	if g <= k:
		print('YES')
	else:
		Z = primeFactor(g)
		if max(Z) > k:
			print('NO')
		else:
			print('YES')


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
for i in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	nums = [int(x) for x in input().split()]
	gcd_all = nums[0]
	for i in nums[1:]:
		gcd_all = gcd(gcd_all, i)
	if gcd_all <= k:
		print('YES')
	elif gcd_all % k == 0 and k != 1:
		print('YES')
	else:
		print('NO')


from functools import reduce
from math import gcd
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	d = reduce(gcd, a)
	print('YES' if d <= k or gcd(d, k) != 1 else 'NO')


import math

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

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s
for i in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	g = arr[0]
	for i in arr:
		g = gcd(g, i)
	s = primeFactors(g)
	flag = 1
	for i in s:
		if i > k:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


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

def primes(n):
	primfac = []
	d = 2
	while d * d <= n:
		while n % d == 0:
			primfac.append(int(d))
			n = n / d
		d = d + 1
	if n > 1:
		primfac.append(int(n))
	return primfac
t = int(input())
while t:
	t = t - 1
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	f = 0
	a = list(map(int, input().split()))
	a.sort()
	x = a[0]
	for i in range(1, n):
		x = comp(x, a[i])
	if x > 1:
		b = primes(x)
		if max(b) > k:
			f = 1
	if f == 0:
		print('YES')
	else:
		print('NO')


import math

def get_input():
	ip = input().split()
	return [int(i) for i in ip]

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
t = int(input())
for _ in range(t):
	(n, k) = get_input()
	A = get_input()
	res = A[0]
	for c in A[1:]:
		res = gcd(res, c)
	while res >= k:
		a1 = gcd(res, k)
		res = res / a1
		if a1 == 1:
			break
	if res <= k:
		print('YES')
	else:
		print('NO')


import math

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
for _ in range(int(input().strip())):
	(n, k) = map(int, input().split(' '))
	a = [int(x) for x in input().split(' ')]
	gcd = a[0]
	for i in range(1, n - 1):
		gcd = find_gcd(gcd, a[i])
	while True and k != 1:
		if gcd % 2 == 0:
			gcd = gcd / 2
		else:
			break
	for i in range(3, int(math.sqrt(gcd) + 2), 2):
		if i <= k and gcd % i == 0:
			while gcd % i == 0:
				gcd = int(gcd / i)
		elif i > k:
			break
	if n == 1:
		if a[0] == 1:
			print('YES')
		else:
			print('NO')
	elif gcd > k and gcd != 1:
		print('NO')
	else:
		print('YES')


import math

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

def maxPrimeFactors2(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(k, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	for i in range(n):
		if n <= 100 and k <= 100:
			x = maxPrimeFactors1(a[i])
		else:
			x = maxPrimeFactors2(a[i])
		if x <= k:
			print('YES')
			break
	else:
		print('NO')


import math

def find_gcd_array(ip):
	result = ip[0]
	for i in ip[1:]:
		result = math.gcd(result, i)
	return result

def find_factors(n, factors):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			if n / i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n / i)
t = int(input())
while t > 0:
	st = input().split()
	n = int(st[0])
	k = int(st[1])
	ip = list(map(int, input().split()))
	result = find_gcd_array(ip)
	factors = [result]
	find_factors(result, factors)
	flag = False
	for i in factors:
		if i <= k:
			print('YES')
			flag = True
			break
	if not flag:
		print('NO')
	t -= 1


def isPrime(n):
	if n <= 11:
		return n in [2, 3, 5, 7, 11]
	(r, d) = (0, n - 1)
	while d % 2 == 0:
		r += 1
		d //= 2
	for a in [2, 3, 5, 7, 11]:
		(probablePrime, b0) = (False, pow(a, d, n))
		if b0 in [1, n - 1]:
			probablePrime = True
			continue
		bi = b0
		for i in range(1, r):
			bi = bi ** 2 % n
			if bi == 1:
				probablePrime = False
				break
			if bi == n - 1:
				probablePrime = True
				break
		if probablePrime == False:
			return False
	return True

def getSmallPrimes(smallPrimeLimit):
	smallPrimes = [False, False] + [True for n in range(2, smallPrimeLimit + 1)]
	for i in range(smallPrimeLimit):
		if smallPrimes[i]:
			for multiple in range(2 * i, smallPrimeLimit + 1, i):
				smallPrimes[multiple] = False
	return smallPrimes
smallPrimeLimit = 10 ** 1
smallPrimes = getSmallPrimes(smallPrimeLimit)
del smallPrimeLimit, getSmallPrimes

def getPrimeFactors(n):
	if n % 2 == 0:
		primeFactors = [2]
		n //= 2
		while n % 2 == 0:
			primeFactors.append(2)
			n //= 2
	else:
		primeFactors = []
	factor = 3
	if isPrime(n):
		primeFactors.append(n)
		n = 1
	while n != 1:
		if n % factor == 0 and isPrime(factor):
			primeFactors.append(factor)
			n //= factor
			while n % factor == 0:
				primeFactors.append(factor)
				n //= factor
			if isPrime(n):
				primeFactors.append(n)
				n = 1
		factor += 2
	return primeFactors
T = int(input())
for _ in range(T):
	(N, K) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	firstPrimes = getPrimeFactors(A[0])
	firstPrimes = [factor for factor in firstPrimes if factor > K]
	for prime in firstPrimes:
		for a in A[1:]:
			if a % prime != 0:
				break
		else:
			print('NO')
			break
	else:
		print('YES')


import math

def div(n):
	d = []
	while n % 2 == 0:
		d.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			d.append(i)
			n = n // i
	if n > 2:
		d.append(n)
	return set(d)
for test in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	d = div(min(l))
	check = 0
	for i in d:
		count = 0
		if i > k:
			for j in range(n):
				if l[j] % i == 0:
					count += 1
				else:
					break
			if count == n:
				print('NO')
				check = 1
				break
	if check == 0:
		print('YES')


import math
for j in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	if n >= 2:
		while 1:
			x = math.gcd(a[0], a[1])
			for i in range(2, n):
				x = math.gcd(x, a[i])
			if x == 1:
				print('YES')
				break
			elif x <= k:
				for i in range(n):
					a[i] = a[i] // x
			elif x % 2 != 0:
				print('NO')
				break
			else:
				while x > k:
					x = x // 2
				if x == 1:
					print('NO')
					break
				for i in range(n):
					a[i] = a[i] // x
	else:
		print('NO')


from math import gcd

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return factors
for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split(' ')]
	A = [int(x) for x in input().split(' ')]
	g = A[0]
	for a in A[1:]:
		g = gcd(g, a)
	b = True
	for a in prime_factors(g):
		if a > k:
			print('NO')
			b = False
			break
	if b:
		print('YES')


def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(pow(n, 0.5) + 1)) if n % i == 0)))
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if n > 1:
		num1 = a[0]
		num2 = a[1]
		gcd = find_gcd(num1, num2)
		for i in range(2, n):
			gcd = find_gcd(gcd, a[i])
	else:
		gcd = a[0]
	if gcd <= k:
		print('YES')
	else:
		s1 = factors(gcd)
		l = list(s1)
		l.sort()
		pos = 1
		r = set()
		if l != None:
			l.remove(1)
			for x in l:
				while gcd / x == gcd // x:
					r.add(x)
					gcd /= x
			for x in r:
				if x > k:
					print('NO')
					pos = 0
					break
		else:
			pos = 0
			print('NO')
		if pos == 1:
			print('YES')


import math

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

def check(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)
t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	count = 0
	for i in range(n):
		if a[i] <= k or a[i] == 1:
			count = 1
			break
	if count == 1:
		print('YES')
	elif k == 1:
		print('NO')
	else:
		num1 = a[0]
		num2 = a[1]
		gcd = find_gcd(num1, num2)
		for i in range(2, len(a)):
			gcd = find_gcd(gcd, a[i])
		if check(gcd) == 0:
			mainanswer = gcd
		else:
			mainanswer = check(gcd)
		if mainanswer <= k:
			print('YES')
		else:
			print('NO')
	t = t - 1


def pfac(n):
	ar = []
	if n % 2 == 0:
		ar.append(2)
	while n % 2 == 0:
		n //= 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		if n % i == 0:
			ar.append(i)
		while n % i == 0:
			n //= i
	if n > 2:
		ar.append(n)
	return ar
import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ar = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		g = math.gcd(ar[0], ar[1])
		for i in range(2, n):
			g = math.gcd(g, ar[i])
		if g <= k:
			print('YES')
		else:
			gar = pfac(g)
			flag = 1
			for i in range(len(gar)):
				if gar[i] > k:
					flag = 0
					break
			if flag == 1:
				print('YES')
			else:
				print('NO')


from math import gcd
R = lambda : map(int, input().split())
t = int(input())
for _ in range(t):
	(n, k) = R()
	a = R()
	g = next(a)
	for x in a:
		g = gcd(g, x)
	i = 2
	while i <= min(int(g ** 0.5), k):
		while g % i == 0:
			g //= i
		i += 1
	print(('YES', 'NO')[g > k])


from math import gcd
from collections import deque
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	res = arr[0]
	for num in arr[1:]:
		res = gcd(res, num)
	ans = 'YES'
	pf = []
	store_res = res
	while res % 2 == 0:
		res = res // 2
		pf.append(2)
	for i in range(3, int(res ** 0.5) + 1, 2):
		while res % i == 0:
			res = res // i
			pf.append(i)
	pf.append(res)
	pf = deque(pf)
	res = store_res
	while res > 1:
		res1 = res
		while pf:
			if pf[0] > k:
				break
			if res % pf[0] == 0 and pf[0] <= k:
				res = res // pf[0]
				pf.popleft()
				break
		if res == res1:
			ans = 'NO'
			break
	print(ans)


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

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

def si():
	return input()

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

def lpf(n):
	d = 2
	temp = d
	while d * d <= n:
		while n % d == 0:
			if d > temp:
				temp = d
			n //= d
		d += 1
	if n > temp:
		temp = n
	return temp

def sol():
	(n, k) = mi()
	if n == 1:
		print('NO')
		return
	arr = list(mi())
	a = arr[0]
	for i in range(n - 1):
		a = gcd(a, arr[i])
	b = lpf(a)
	if a == 1:
		print('YES')
	elif b > k:
		print('NO')
	else:
		print('YES')
for _ in range(ii()):
	sol()