Slime has a sequence of positive integers $a_1, a_2, \ldots, a_n$.

In one operation Orac can choose an arbitrary subsegment $[l \ldots r]$ of this sequence and replace all values $a_l, a_{l + 1}, \ldots, a_r$ to the value of median of $\{a_l, a_{l + 1}, \ldots, a_r\}$.

In this problem, for the integer multiset $s$, the median of $s$ is equal to the $\lfloor \frac{|s|+1}{2}\rfloor$-th smallest number in it. For example, the median of $\{1,4,4,6,5\}$ is $4$, and the median of $\{1,7,5,8\}$ is $5$.

Slime wants Orac to make $a_1 = a_2 = \ldots = a_n = k$ using these operations.

Orac thinks that it is impossible, and he does not want to waste his time, so he decided to ask you if it is possible to satisfy the Slime's requirement, he may ask you these questions several times.


-----Input-----

The first line of the input is a single integer $t$: the number of queries.

The first line of each query contains two integers $n\ (1\le n\le 100\,000)$ and $k\ (1\le k\le 10^9)$, the second line contains $n$ positive integers $a_1,a_2,\dots,a_n\ (1\le a_i\le 10^9)$

The total sum of $n$ is at most $100\,000$.


-----Output-----

The output should contain $t$ lines. The $i$-th line should be equal to 'yes' if it is possible to make all integers $k$ in some number of operations or 'no', otherwise. You can print each letter in lowercase or uppercase.


-----Example-----
Input
5
5 3
1 5 2 6 1
1 6
6
3 2
1 2 3
4 3
3 1 2 3
10 3
1 2 3 4 5 6 7 8 9 10

Output
no
yes
yes
no
yes



-----Note-----

In the first query, Orac can't turn all elements into $3$.

In the second query, $a_1=6$ is already satisfied.

In the third query, Orac can select the complete array and turn all elements into $2$.

In the fourth query, Orac can't turn all elements into $3$.

In the fifth query, Orac can select $[1,6]$ at first and then select $[2,10]$.

Difficulty: HARD
Tags: Greedy algorithms

Mathematics

Constructive algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def judge(L, k):
	L.sort()
	return L[1] >= k

def solve(n, k, A):
	if k not in A:
		return 'no'
	l = len(A)
	if l == 1:
		return 'yes'
	if l == 2:
		if min(A) == k:
			return 'yes'
		return 'no'
	for i in range(l - 2):
		L = A[i:i + 3]
		if judge(L, k):
			return 'yes'
	return 'no'

def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		A = list(map(int, input().split()))
		ans = solve(n, k, A)
		sys.stdout.write(ans + '\n')
main()


from sys import stdin
input = stdin.readline

def solve(a, k, n):
	b = []
	has_k = False
	for item in a:
		if item == k:
			b.append(1)
			has_k = True
		elif item < k:
			b.append(0)
		else:
			b.append(2)
	if not has_k:
		return False
	if n == 1:
		return True
	for i in range(n):
		if b[i] > 0:
			if i + 1 < n and b[i + 1] > 0:
				return True
			if i + 2 < n and b[i + 2] > 0:
				return True
	return False
for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	print('yes' if solve(a, k, n) else 'no')


tt = int(input())
for ts in range(tt):
	(n, k) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	ok = n == 1 and a[0] == k
	if k in a:
		for i in range(n - 1):
			ok |= a[i] >= k and (a[i + 1] >= k or (i < n - 2 and a[i + 2] >= k))
	print('yes' if ok else 'no')


import sys
import math
from collections import defaultdict

def solve(test):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	a += [0, 0]
	if n == 1 and a[0] == k:
		print('yes')
		return
	(flag1, flag2) = (0, 0)
	for i in range(n):
		if a[i] == k:
			flag1 = 1
		if a[i] >= k:
			if a[i + 1] >= k or a[i + 2] >= k:
				flag2 = 1
	print('yes' if flag1 and flag2 else 'no')
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	B = [1] * n
	for i in range(n):
		if A[i] < k:
			B[i] = -1
	if n == 1 and A[0] == k:
		print('yes')
		continue
	if not k in A:
		print('no')
		continue
	SUM = 0
	ok = 0
	flag = 0
	for i in range(n):
		SUM += B[i]
		if SUM >= 0 and flag:
			ok = 1
			print('yes')
			break
		if B[i] == 1:
			flag = 1
			SUM = 0
	if ok:
		continue
	SUM = 0
	flag = 0
	for i in range(n - 1, -1, -1):
		SUM += B[i]
		if SUM >= 0 and flag:
			ok = 1
			print('yes')
			break
		if B[i] == 1:
			flag = 1
			SUM = 0
	if ok:
		continue
	else:
		print('no')


def solve():
	(n, k) = [int(x) for x in input().split()]
	li = [int(x) for x in input().split()]
	if n == 1 and li[0] == k:
		print('yes')
		return
	elif n == 1 and li[0] != k:
		print('no')
		return
	for i in range(n):
		if li[i] == k:
			break
	else:
		print('no')
		return
	for i in range(n - 1):
		if li[i] >= k:
			if li[i + 1] >= k:
				print('yes')
				return
			if i < n - 2 and li[i + 2] >= k:
				print('yes')
				return
	else:
		print('no')
		return
t = int(input())
for i in range(t):
	solve()


import sys
from collections import deque
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	(n, k) = nm()
	l = nl()
	if min(l) == max(l) == k:
		print('yes')
		return
	if k not in l:
		print('no')
		return
	l = [x >= k for x in l] + [0, 0]
	print('yes' if max((sum(l[i:i + 3]) for i in range(n))) > 1 else 'no')
T = ni()
for _ in range(T):
	solve()


from sys import stdin, stdout
input = stdin.readline

def print(s):
	stdout.write(s + '\n')
t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	a = []
	has = False
	for i in input().split():
		x = int(i)
		if x == k:
			has = True
		a.append(x >= k)
	if not has:
		print('no')
		continue
	if n == 1:
		print('yes')
		continue
	ans = False
	for i in range(n - 1):
		if a[i] and a[i + 1]:
			ans = True
			break
	if not ans:
		for i in range(n - 2):
			if a[i] and a[i + 2]:
				ans = True
				break
	print('yes' if ans else 'no')


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

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

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

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

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

def string_list():
	return list(input())

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

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

def solve():
	(n, k) = num_input()
	arr = list_input()
	temp = []
	if not k in arr:
		print('no')
		return
	if n == 1:
		print('yes')
		return
	for i in range(n - 2):
		if arr[i] >= k and (arr[i + 1] >= k or arr[i + 2] >= k):
			print('yes')
			return
	if arr[-2] >= k and arr[-1] >= k:
		print('yes')
		return
	print('no')
t = int(input())
for _ in range(t):
	solve()


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		(n, k) = list(map(int, stdin.readline().split()))
		arr = list(map(int, stdin.readline().split()))
		if n == 1 and k == arr[0]:
			stdout.write('yes\n')
			continue
		elif n == 1:
			stdout.write('no\n')
			continue
		dp_l = [-1] * (n + 1)
		cnt = 0
		found = False
		for (i, x) in enumerate(arr):
			if x >= k and i > 0:
				if arr[i - 1] >= k:
					found = True
					break
			if x >= k and i > 1:
				if arr[i - 2] >= k:
					found = True
					break
		true_found = False
		for (i, x) in enumerate(arr):
			if x == k and found:
				true_found = True
				break
		if true_found:
			stdout.write('yes\n')
		else:
			stdout.write('no\n')
main()


def check_gk(A, k):
	N = len(A)
	for i in range(N - 1):
		if A[i] >= k and A[i + 1] >= k:
			return True
	for i in range(N - 2):
		if A[i] >= k and A[i + 2] >= k:
			return True
	return False

def answer(b):
	if b:
		print('yes')
	else:
		print('no')
t = int(input())
for i in range(t):
	(n, k) = input().split(' ')
	(n, k) = (int(n), int(k))
	A = list(map(int, input().split(' ')))
	if n <= 1:
		answer(k in A)
	else:
		answer(k in A and check_gk(A, k))


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 = 10 ** 9 + 7

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(str(i)[2:-1]) for i in input().rstrip()]

def do2(l):
	n = len(l)
	for i in range(2, n + 1):
		if sum(l[i - 2:i + 1]) > 0 or sum(l[i - 2:i]) > 0:
			return 1
	return 0
for _ in range(val()):
	(n, k) = li()
	l = li()
	if k not in l:
		print('NO')
		continue
	if n == 1:
		print('YES')
		continue
	l = [-1 if i < k else 1 for i in l]
	print('YES' if do2(l) else 'NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if n == 1 and k == l[0]:
		print('yes')
		continue
	elif n == 1:
		print('no')
		continue
	v = []
	f = 0
	for t in range(n):
		if l[t] == k:
			f = 1
		if l[t] >= k:
			v.append(t + 1)
	if not f:
		print('no')
	else:
		f = 0
		for t in range(1, len(v)):
			if v[t] - v[t - 1] <= 2:
				f = 1
		print('yes' if f else 'no')


printn = lambda x: print(x, end='')
import sys
input = sys.stdin.readline
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : map(int, input().split())
ins = lambda : input().strip()
DBG = True
BIG = 10 ** 18
R = 10 ** 9 + 7

def ddprint(x):
	if DBG:
		print(x)
t = inn()
for tt in range(t):
	(n, k) = inm()
	a = inl()
	if a.count(k) == 0:
		print('no')
		continue
	if n == 1:
		print('yes')
		continue
	done = False
	for i in range(n):
		if a[i] < k:
			continue
		sml = 0
		for j in range(i - 1, -1, -1):
			sml += 1 if a[j] < k else -1
			if sml <= 0:
				print('yes')
				done = True
				break
			if a[j] >= k:
				break
		if done:
			break
		sml = 0
		for j in range(i + 1, n):
			sml += 1 if a[j] < k else -1
			if sml <= 0:
				print('yes')
				done = True
				break
			if a[j] >= k:
				break
		if done:
			break
	if not done:
		print('no')


import sys
input = sys.stdin.readline
t = int(input())
for test in range(t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = []
	for i in range(len(a)):
		if a[i] == k:
			b.append(1)
		elif a[i] < k:
			b.append(0)
		else:
			b.append(2)
	if 1 not in b:
		print('no')
		continue
	if n == 1:
		print('yes')
		continue
	if n == 2:
		num_zeros = 0
		num_ones = 0
		num_twos = 0
		for j in range(2):
			if b[j] == 0:
				num_zeros += 1
			elif b[j] == 1:
				num_ones += 1
			elif b[j] == 2:
				num_twos += 1
		if num_ones + num_twos >= 2:
			print('yes')
			continue
		else:
			print('no')
			continue
	flag = 0
	for i in range(n - 2):
		num_zeros = 0
		num_ones = 0
		num_twos = 0
		for j in range(3):
			if b[i + j] == 0:
				num_zeros += 1
			elif b[i + j] == 1:
				num_ones += 1
			elif b[i + j] == 2:
				num_twos += 1
		if num_ones + num_twos >= 2:
			flag = 1
			break
	if flag == 1:
		print('yes')
		continue
	else:
		print('no')
		continue


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(n, k) = map(int, stdin.readline().split())
	arr = list(map(int, stdin.readline().split()))
	ans = 'no\n'
	if arr.count(k) >= 1:
		if len(arr) == 1:
			ans = 'yes\n'
		else:
			for i in range(n - 1):
				if arr[i] >= k and arr[i + 1] >= k:
					ans = 'yes\n'
					break
			for i in range(n - 2):
				if arr[i] >= k and arr[i + 2] >= k:
					ans = 'yes\n'
					break
	stdout.write(ans)


from sys import stdin, stdout
import sys
from math import *
input = stdin.readline
for __ in range(int(input())):
	(n, k) = map(int, input().split())
	ar = list(map(int, input().split()))
	if k not in ar:
		print('No')
	elif n == 1:
		print('Yes')
	else:
		ans = 'No'
		for i in range(n - 1):
			if ar[i] >= k <= ar[i + 1]:
				ans = 'Yes'
		for i in range(n - 2):
			if ar[i] >= k <= ar[i + 2]:
				ans = 'Yes'
		print(ans)


production = True
import sys, math, collections

def input(f=0, m=0):
	if m > 0:
		return [input(f) for i in range(m)]
	else:
		l = sys.stdin.readline()[:-1]
		if f >= 10:
			u = False
			f = int(str(f)[-1])
		else:
			u = True
		if f == 0:
			p = [l]
		elif f == 1:
			p = list(map(int, l.split()))
		elif f == 2:
			p = list(map(float, l.split()))
		elif f == 3:
			p = list(l)
		elif f == 4:
			p = list(map(int, list(l)))
		elif f == 5:
			p = l.split()
		return p if u else p[0]

def out(l, f=0, n=True):
	if f == 0:
		p = str(l)
	elif f == 1:
		p = ' '.join(map(str, l))
	elif f == 2:
		p = '\n'.join(map(str, l))
	elif f == 3:
		p = ''.join(map(str, l))
	print(p, end='\n' if n else '')

def log(*args):
	if not production:
		print('$$$', end='')
		print(*args)
enu = enumerate
ter = lambda a, b, c: b if a else c
ceil = lambda a, b: -(-a // b)
flip = lambda a: a + 1 & 1

def mapl(i, f=0):
	if f == 0:
		return list(map(int, i))
	elif f == 1:
		return list(map(str, i))
	elif f == 2:
		return list(map(list, i))

def solve():
	(n, k) = input(1)
	a = input(1)
	f1 = 0
	f2 = 0
	for i in range(n):
		if a[i] == k:
			f1 = 1
		if a[i] >= k:
			try:
				if a[i + 1] >= k or a[i + 2] >= k:
					f2 = 1
			except:
				pass
		if f1 and (f2 or n == 1):
			out('yes')
			break
	else:
		out('no')
	return
for i in range(input(11)):
	solve()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	if k not in arr:
		print('no')
		continue
	else:
		flag = False
		if n == 1:
			print('yes')
			continue
		sum_cnt = 0
		segment_l = 0
		for j in arr:
			if j < k:
				sum_cnt -= 1
			else:
				sum_cnt += 1
			segment_l += 1
			if sum_cnt > 0 and segment_l > 1:
				print('yes')
				flag = True
				break
			if j >= k:
				sum_cnt = 1
				segment_l = 1
		if not flag:
			print('no')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	if k not in l:
		print('no')
	elif n == 1:
		print('yes')
	elif any((u >= k <= v for (u, v) in zip(l, l[1:]))):
		print('yes')
	elif any((u >= k <= v for (u, v) in zip(l, l[2:]))):
		print('yes')
	else:
		print('no')


def orac(n, arr, k):
	if n == 1 and arr[0] == k:
		return 'yes'
	c = 0
	d = 0
	if arr[n - 1] == k:
		c = 1
	for i in range(n - 1):
		if arr[i] == k:
			c = 1
		if min(arr[i], arr[i + 1]) >= k:
			d = 1
		if c == 1 and d == 1:
			break
	if d == 0:
		for i in range(n - 2):
			l = [arr[i], arr[i + 1], arr[i + 2]]
			l.sort()
			if min(l[1], l[2]) >= k:
				d = 1
				break
	if d == 1 and c == 1:
		return 'yes'
	return 'no'
for i in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	print(orac(n, arr, k))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(0, t):
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	f = 0
	for i in range(0, n):
		if a[i] == k:
			f = 1
			break
	if f == 0:
		print('no')
		continue
	if n == 1:
		print('yes')
		continue
	f = 0
	for i in range(0, n):
		if i == 0:
			if a[i] >= k and a[i + 1] >= k:
				f = 1
		elif i == n - 1:
			if a[i] >= k and a[i - 1] >= k:
				f = 1
		elif a[i] >= k:
			if a[i - 1] >= k or a[i + 1] >= k:
				f = 1
		elif a[i] <= k:
			if a[i + 1] >= k and a[i - 1] >= k:
				f = 1
	if f:
		print('yes')
	else:
		print('no')


def solve():
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	flag = False
	for i in range(n):
		val = 0
		if a[i] == k:
			val = 1
			flag = True
		elif a[i] > k:
			val = 2
		a[i] = val
	if not flag:
		return 0
	if n == 1:
		return 1
	for i in range(n):
		j = i + 1
		while j < n and j - i <= 2:
			if a[i] and a[j]:
				return 1
			j += 1
	return 0
T = int(input())
for t in range(T):
	res = solve()
	if res:
		print('yes')
	else:
		print('no')


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

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

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

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

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

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		(n, k) = MI()
		aa = LI()
		if k not in aa:
			print('no')
			continue
		if n == 1:
			if aa[0] == k:
				print('yes')
			else:
				print('no')
			continue

		def ok(xx):
			ks = set()
			s = 0
			for a in xx:
				s += (a >= k) * 2 - 1
				if s in ks or s - 1 in ks:
					return True
				if a >= k:
					ks.add(s)
		if ok(aa) or ok(aa[::-1]):
			print('yes')
		else:
			print('no')
main()


t = int(input())

def go(a, k):
	if k not in a:
		return 'no'
	if len(a) == 1:
		return 'yes'
	if len(a) == 2 and sum(a) >= 2 * k:
		return 'yes'
	for (a1, a2, a3) in zip(a, a[1:], a[2:]):
		if (a1 >= k) + (a2 >= k) + (a3 >= k) > 1:
			return 'yes'
	return 'no'
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if len(a) == 1 and a[0] == k:
		print('yes')
	else:
		print(go(a, k))


import sys
input = iter(sys.stdin.readlines()).__next__
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))

	def find_way():
		c = a.count(k)
		if c == n:
			return True
		if c == 0:
			return False
		for i in range(n):
			if a[i] >= k:
				try:
					if a[i + 1] >= k or a[i + 2] >= k:
						return True
				except IndexError:
					pass
		else:
			return False
	print('yes' if find_way() else 'no')


from sys import stdin
input = stdin.readline

def solve():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if len(a) == 1:
		if a[0] == k:
			print('yes')
		else:
			print('no')
		return
	if k not in a:
		print('no')
		return
	flag = 0
	for i in range(n):
		if a[i] > k:
			a[i] = k
	for i in range(n - 1):
		if min(a[i], a[i + 1]) == k:
			flag = 1
	for i in range(n - 2):
		x = [a[i], a[i + 1], a[i + 2]]
		x.sort()
		if x[1] == k:
			flag = 1
	if flag:
		print('yes')
	else:
		print('no')
for _ in range(int(input())):
	solve()


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

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

def solve(n, k, a):
	flag = False
	for i in range(n):
		if a[i] < k:
			a[i] = 0
		elif a[i] > k:
			a[i] = 2
		else:
			a[i] = 1
		if a[i] == 1:
			flag = True
	if not flag:
		return False
	if n == 1:
		return True
	for i in range(n):
		for j in range(i + 1, i + 3):
			if j < n and a[i] and a[j]:
				return True
	return False

def main():
	for _ in range(ri()):
		(n, k) = ria()
		a = ria()
		print('yes' if solve(n, k, a) else 'no')
main()


import os
import sys
input = sys.stdin.readline
from collections import deque
import math

class CF(object):

	def __init__(self):
		self.t = int(input())
		self.a = None
		self.k = None
		self.n = None

	def gao(self):
		if not self.k in self.a:
			return False
		if self.n == 1:
			return True
		for i in range(1, self.n):
			if self.a[i] >= self.k:
				if self.a[i - 1] >= self.k:
					return True
				elif i >= 2:
					if self.a[i - 2] >= self.k:
						return True
		pass
		return False

	def main(self):
		for _ in range(self.t):
			(self.n, self.k) = list(map(int, input().split()))
			self.a = list(map(int, input().split()))
			if self.gao():
				print('yes')
			else:
				print('no')
		pass
cf = CF()
cf.main()
pass


import math
inf = 10 ** 9 + 100
t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	fl = 0
	for i in range(n):
		if a[i] == k:
			fl = 1
		if a[i] >= k:
			a[i] = 1
		else:
			a[i] = 0
	if fl == 0:
		print('no')
		continue
	if n == 1:
		if fl:
			print('yes')
		else:
			print('no')
		continue
	bl = [0] * (n + 2)
	sm = [0] * (n + 2)
	minn = inf
	fl = 0
	for i in range(n):
		bl[i + 1] = bl[i]
		sm[i + 1] = sm[i]
		if a[i] == 0:
			sm[i + 1] += 1
		else:
			bl[i + 1] += 1
		if minn < bl[i + 1] - sm[i + 1]:
			fl = 1
		minn = min(minn, bl[i] - sm[i])
	if fl:
		print('yes')
	else:
		print('no')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	f1 = f2 = False
	if n == 1:
		if a[0] == k:
			print('yes')
		else:
			print('no')
	else:
		for i in range(n):
			if a[i] == k:
				f1 = True
			if a[i] >= k:
				if i < n - 1 and a[i + 1] >= k or (i < n - 2 and a[i + 2] >= k):
					f2 = True
		if f1 == True and f2 == True:
			print('yes')
		else:
			print('no')


import os
import sys
if os.path.exists('/mnt/c/Users/Square/square/codeforces'):
	f = iter(open('D.txt').readlines())

	def input():
		return next(f)
else:
	input = sys.stdin.readline

def go(n, k, A):
	if k not in A:
		return 'no'
	if all([i == k for i in A]):
		return 'yes'
	minf = -2000000000.0
	positions = [n for (n, a) in enumerate(A) if a >= k]
	m = min(list(map(lambda x: x[0] - x[1], zip(positions[1:], positions))) + [3])
	if m <= 2:
		return 'yes'
	else:
		return 'no'
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	print(go(n, k, A))


from sys import stdin, stdout

def orac_and_medians(n, k, a):
	if len(a) == 1 and a[0] == k:
		return 'yes'
	f1 = False
	f2 = False
	for i in range(n):
		if a[i] == k:
			f1 = True
		if i - 1 >= 0 and a[i] >= k and (a[i - 1] >= k):
			f2 = True
			if f1:
				break
		if i - 2 >= 0 and a[i] >= k and (a[i - 2] >= k):
			f2 = True
			if f1:
				break
	if f1 and f2:
		return 'yes'
	else:
		return 'no'
t = int(stdin.readline())
for i in range(t):
	(n, k) = list(map(int, stdin.readline().split()))
	a = list(map(int, stdin.readline().split()))
	stdout.write(orac_and_medians(n, k, a) + '\n')


import sys
import math as mt
input = sys.stdin.buffer.readline
t = int(input())
for __ in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	ch = 0
	for i in l:
		if i == k:
			ch += 1
	if ch == 0:
		print('NO')
	else:
		ch1 = 0
		if n == 1 and l[0] == k:
			ch1 = 1
		for i in range(n - 1):
			if l[i] >= k and l[i + 1] >= k:
				ch1 = 1
		for i in range(n):
			cnt = 0
			for j in range(i, min(n, i + 3)):
				if l[j] >= k:
					cnt += 1
			if cnt >= 2:
				ch1 = 1
		if ch1 == 1:
			print('YES')
		else:
			print('NO')


class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: gcd(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
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 bisect import bisect_right, bisect_left
from fractions import Fraction

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans
from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if n == 1:
		print('yes' if a[0] == k else 'no')
		continue
	if n == 2:
		print('yes' if k == min(a) else 'no')
		continue
	found = k in a
	pos = False
	for i in range(n - 2):
		cnt = 0
		for j in range(i, i + 3):
			if a[j] >= k:
				cnt += 1
		if cnt > 1:
			pos = True
			break
	print('yes' if pos and found else 'no')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	flag = 0
	for i in range(n):
		if a[i] == k:
			flag = 1
	if flag == 0:
		print('no')
	else:
		flag = 0
		count = 10000000
		for i in range(n):
			if a[i] >= k:
				if count <= 1:
					flag = 1
				count = 0
			else:
				count += 1
		if flag == 1 or n == 1:
			print('yes')
		else:
			print('no')


t = int(input())
out = []
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	sign = False
	if k not in arr:
		out.append('no')
	elif n == 1 and arr[0] == k:
		out.append('yes')
	elif n == 1 and arr[0] != k:
		out.append('no')
	else:
		for j in range(n):
			if arr[j] >= k and j > 0:
				if arr[j - 1] >= k:
					sign = True
				if arr[j - 2] >= k and j > 1:
					sign = True
		if sign:
			out.append('yes')
		else:
			out.append('no')
for m in out:
	print(m)


def resolve():

	def search(a, k):
		if a == [k]:
			print('yes')
			return
		if not k in a:
			print('no')
			return
		n = len(a)
		for (index, i) in enumerate(a):
			if i >= k:
				if index > 1:
					if a[index - 2] >= k:
						print('yes')
						return
				if index > 0:
					if a[index - 1] >= k:
						print('yes')
						return
				if index < n - 2:
					if a[index + 2] >= k:
						print('yes')
						return
				if index < n - 1:
					if a[index + 1] >= k:
						print('yes')
						return
		print('no')
		return
	import sys
	input = sys.stdin.readline
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		a = list(map(int, input().split()))
		search(a, k)
resolve()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	indexes = []
	highlow = []
	a = [int(item) for item in input().split()]
	for (i, item) in enumerate(a):
		if item < k:
			highlow.append(0)
		elif item == k:
			highlow.append(1)
			indexes.append(i)
		else:
			highlow.append(1)
	if len(indexes) == 0:
		print('no')
		continue
	if n == 1:
		print('yes')
		continue
	if n == 2:
		if highlow == [1, 1]:
			print('yes')
		else:
			print('no')
		continue
	ok = False
	for (h1, h2, h3) in zip(highlow, highlow[1:], highlow[2:]):
		if h1 + h2 + h3 >= 2:
			ok = True
			break
	if ok:
		print('yes')
	else:
		print('no')


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 factorial, ceil
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

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())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

def main():
	for _ in range(N()):
		(n, k) = RL()
		arr = RLL()
		s = ''
		for i in arr:
			if i < k:
				s += 's'
			else:
				s += 'l'
		print('yes' if (len(s) == 1 or 'll' in s or 'lsl' in s) and k in arr else 'no')
main()


def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		a = list(map(int, input().split()))
		if k not in a:
			print('no')
			continue
		if n == 1:
			print('yes')
			continue
		bl = False
		for i in range(n):
			if a[i] < k:
				continue
			for j in range(i + 1, min(i + 3, n)):
				if a[j] >= k:
					bl = True
		print('yes' if bl else 'no')
main()


from math import *
from sys import *
input = stdin.readline
for _ in range(int(input())):
	ch1 = 0
	ch = 0
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if n <= 2:
		a.sort()
		if a[0] == k:
			ch1 = 1
			ch = 1
	else:
		for i in range(1, n - 1):
			cn = 0
			if a[i] == k or a[i - 1] == k or a[i + 1] == k:
				ch1 = 1
			if a[i] >= k:
				cn += 1
			if a[i - 1] >= k:
				cn += 1
			if a[i + 1] >= k:
				cn += 1
			if cn >= 2:
				ch = 1
	if ch1 == 1 and ch == 1:
		stdout.write('yes\n')
	else:
		stdout.write('no\n')


import sys
input = sys.stdin.buffer.readline
t = int(input())
ans = []
for _ in range(t):
	(n, k) = map(int, input().split())
	(*a,) = map(int, input().split())
	if k not in a:
		ans.append('no')
		continue
	if n == 1:
		if a[0] == k:
			ans.append('yes')
		else:
			ans.append('no')
		continue
	if n == 2:
		if a[0] == k <= a[1] or a[0] >= k == a[1]:
			ans.append('yes')
		else:
			ans.append('no')
		continue
	up = [1 if x >= k else -1 for x in a]
	for (p, q, r) in zip(up, up[1:], up[2:]):
		if p + q + r > 0:
			ans.append('yes')
			break
	else:
		ans.append('no')
print('\n'.join(ans))


t = int(input())
answers = []
for _ in range(t):
	(n, k) = [int(i) for i in input().split()]
	arr = [int(i) for i in input().split()]
	pos_geq_k = []
	exists = False
	for i in range(n):
		if arr[i] >= k:
			pos_geq_k.append(i)
		if arr[i] == k:
			exists = True
	flag = False
	if exists:
		for i in range(len(pos_geq_k) - 1):
			if pos_geq_k[i + 1] - pos_geq_k[i] <= 2:
				flag = True
				break
	if n == 1 and exists:
		flag = True
	if flag:
		answers.append('yes')
	else:
		answers.append('no')
print(*answers, sep='\n')


def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		a = list(map(int, input().split()))
		if k in a:
			flag = 1
			for (idx, i) in enumerate(a):
				if idx < n - 1:
					if i >= k and a[idx + 1] >= k:
						print('yes')
						flag = 0
						break
				if idx < n - 2:
					if i >= k and a[idx + 2] >= k:
						print('yes')
						flag = 0
						break
			if flag:
				print('no' if n > 1 else 'yes')
		else:
			print('no')
	return
main()


import sys
import math
t = int(sys.stdin.readline().rstrip())
for T in range(t):
	(n, k) = map(int, sys.stdin.readline().rstrip().split())
	a = list(map(int, sys.stdin.readline().rstrip().split()))
	if not k in a:
		print('no')
		continue
	if n == 1:
		print('yes')
		continue
	ok = False
	for i in range(n):
		for j in range(1, 3):
			if i + j >= n:
				continue
			if a[i] >= k and a[i + j] >= k:
				ok = True
	if ok:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in a:
		print('no')
		continue
	if n < 3:
		if n == 1:
			print('yes')
		elif a[0] >= k and a[1] >= k:
			print('yes')
		else:
			print('no')
		continue
	f = 0
	for i in range(n - 2):
		if a[i] >= k and (a[i + 1] >= k or a[i + 2] >= k):
			f = 1
	if not f:
		if a[-1] >= k and a[-2] >= k:
			f = 1
	print('nyoe s'[f::2])


def solve():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	flg = False
	for x in a:
		if x == k:
			flg = True
	if flg == False:
		return 'no'
	if n == 1:
		return 'yes'
	for i in range(n):
		for dx in range(1, 3):
			if i + dx < n and a[i + dx] >= k and (a[i] >= k):
				return 'yes'
	return 'no'
ans = [solve() for _ in range(int(input()))]
print('\n'.join(ans))


from collections import *
from bisect import *
from math import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in a:
		print('no')
		continue
	if n == 1:
		print('Yes')
		continue
	s = []
	for i in a:
		if i < k:
			s.append(-1)
		else:
			s.append(1)
	flag = 0
	for i in range(2, len(s) + 1):
		if sum(s[i - 2:i + 1]) > 0 or sum(s[i - 2:i]) > 0:
			flag = 1
			break
	if flag == 0:
		print('No')
	else:
		print('YEs')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in a:
		print('no')
		continue
	if len(a) == 1:
		print('yes')
		continue
	f = 0
	for i in range(n - 2):
		if a[i] >= k and (a[i + 1] >= k or a[i + 2] >= k):
			print('yes')
			f = 1
			break
	if f:
		continue
	if a[-1] >= k and a[-2] >= k:
		print('yes')
		continue
	print('no')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in a:
		print('No')
	elif n == 1:
		print('Yes')
	elif any((u >= k <= v for (u, v) in zip(a, a[1:]))):
		print('Yes')
	elif any((u >= k <= v for (u, v) in zip(a, a[2:]))):
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = [int(i) for i in input().split() if i != '\n']
	if k not in a:
		print('no')
	elif n == 1:
		print('yes')
	elif a[-1] >= k and a[-2] >= k:
		print('yes')
	else:
		for j in range(n - 2):
			if a[j] >= k and a[j + 2] >= k or (a[j] >= k and a[j + 1] >= k):
				print('yes')
				break
		else:
			print('no')


ans = []
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in a:
		ans.append('no')
		continue
	if n == 1:
		ans.append('yes' if a[0] == k else 'no')
		continue
	good = False
	for i in range(n - 1):
		if a[i] >= k and a[i + 1] >= k:
			good = True
	for i in range(1, n):
		if a[i] >= k and a[i - 1] >= k:
			good = True
	for i in range(1, n - 1):
		if a[i - 1] >= k and a[i + 1] >= k:
			good = True
	ans.append('yes' if good else 'no')
print('\n'.join(ans))


def do2(l):
	for i in range(2, len(l) + 1):
		if sum(l[i - 2:i + 1]) > 0 or sum(l[i - 2:i]) > 0:
			return 1
	return 0
for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	l = [int(i) for i in input().split()]
	if k not in l:
		print('NO')
		continue
	if n == 1:
		print('YES')
		continue
	l = [-1 if i < k else 1 for i in l]
	print('YES' if do2(l) else 'NO')


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]
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
sys.setrecursionlimit(100005)

def solve():
	(n, k) = sep()
	ar = lis()
	if k not in ar:
		print('no')
		return
	if n == 1:
		if ar[0] == k:
			print('yes')
		else:
			print('no')
		return
	if n == 2:
		ar.sort()
		if ar[0] == k:
			print('yes')
		else:
			print('no')
		return
	for i in range(n - 2):
		t = int(ar[i] >= k) + int(ar[i + 1] >= k) + int(ar[i + 2] >= k)
		if t >= 2:
			print('yes')
			return
	print('no')
	return
testcase(int(inp()))


def main():
	import sys, math
	from heapq import heapify, heappush, heappop
	from collections import defaultdict as dd, deque, Counter

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

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

	def out(*var, end='\n'):
		sys.stdout.write(' '.join(map(str, var)) + end)
	INF = int(1000000000.0)
	mod = int(1000000000.0) + 7
	for t in range(int(data())):
		(n, k) = mdata()
		a = mdata()
		if k not in a:
			print('no')
			continue
		if n == 1:
			print('yes')
			continue
		flag = False
		for i in range(n - 1):
			if a[i] >= k and a[i + 1] >= k:
				flag = True
				break
			if i < n - 2:
				if a[i] >= k and a[i + 2] >= k:
					flag = True
					break
		if flag == False:
			print('no')
		else:
			print('yes')
main()


from sys import stdin
for _ in range(int(stdin.readline())):
	(n, k) = map(int, stdin.readline().split())
	l = list(map(int, stdin.readline().split()))
	c = 0
	if k not in l:
		print('no')
		continue
	if n <= 2:
		if n == 1:
			if l[0] == k:
				print('yes')
				continue
			else:
				print('no')
				continue
		elif l[0] >= k and l[1] >= k:
			print('yes')
			continue
		else:
			print('no')
			continue
	for i in range(n - 2):
		g = 0
		if l[i] >= k:
			g += 1
		if l[i + 1] >= k:
			g += 1
		if l[i + 2] >= k:
			g += 1
		if g >= 2:
			print('yes')
			c += 1
			break
	if c == 0:
		print('no')


import sys
minus = -1 * 10 ** 20

class RMQ:

	def __init__(self, N, V):
		(d, k) = (1, 0)
		while d < N:
			d <<= 1
			k += 1
		self.tree = [V for _ in range(2 * d - 1)]
		self.size = d

	def update(self, i, a):
		now = self.size - 1 + i
		self.tree[now] = a
		while now > 0:
			now = (now - 1) // 2
			self.tree[now] = max(self.tree[2 * now + 1], self.tree[2 * now + 2])

	def search(self, lower, higher, lbound, hbound, pos):
		if higher <= lbound or hbound <= lower:
			return minus
		if lower <= lbound and hbound <= higher:
			return self.tree[pos]
		else:
			left = self.search(lower, higher, lbound, (lbound + hbound) // 2, 2 * pos + 1)
			right = self.search(lower, higher, (lbound + hbound) // 2, hbound, 2 * pos + 2)
			return max(left, right)

def solve():
	input = sys.stdin.readline
	T = int(input())
	Ans = ['yes' for _ in range(T)]
	for t in range(T):
		(N, K) = map(int, input().split())
		A = [int(a) for a in input().split()]
		if N == 1:
			if A[0] != K:
				Ans[t] = 'no'
		elif K not in A:
			Ans[t] = 'no'
		else:
			segTreeR = RMQ(N, minus)
			segTreeL = RMQ(N, minus)
			sAR = [0] * N
			sAL = [0] * N
			sAR[0] = 1 if A[0] >= K else -1
			sAL[N - 1] = 1 if A[N - 1] >= K else -1
			segTreeR.update(0, sAR[0])
			segTreeL.update(N - 1, sAL[N - 1])
			for i in range(1, N):
				if A[i] >= K:
					sAR[i] = sAR[i - 1] + 1
				else:
					sAR[i] = sAR[i - 1] - 1
				segTreeR.update(i, sAR[i])
				if A[N - i - 1] >= K:
					sAL[N - 1 - i] = sAL[N - i] + 1
				else:
					sAL[N - 1 - i] = sAL[N - i] - 1
				segTreeL.update(N - i - 1, sAL[N - i - 1])
			for (k, a) in enumerate(A):
				if a >= K:
					(leftMax, rightMax) = (-10 ** 20, -10 ** 20)
					if k > 0:
						leftMax = segTreeL.search(0, k, 0, segTreeL.size, 0)
					if k < N - 1:
						rightMax = segTreeR.search(k + 1, N, 0, segTreeR.size, 0)
					if leftMax >= sAL[k] or rightMax >= sAR[k]:
						break
			else:
				Ans[t] = 'no'
	print('\n'.join(Ans))
	return 0
solve()


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = ['no'] * T
for qu in range(T):
	(N, K) = list(map(int, readline().split()))
	A = list(map(int, readline().split()))
	A = [-1 if a < K else 0 if a == K else 1 for a in A]
	if 0 not in A:
		continue
	for i in range(1, N - 1):
		if A[i] < 0 and A[i - 1] >= 0 and (A[i + 1] >= 0):
			A[i] = 1
	for i in range(2, N):
		if A[i] < 0 and A[i - 1] >= 0 and (A[i - 2] >= 0):
			A[i] = 1
	for i in range(N - 3, -1, -1):
		if A[i] < 0 and A[i + 1] >= 0 and (A[i + 2] >= 0):
			A[i] = 1
	for i in range(1, N):
		if A[i] == 1 and A[i - 1] == 0:
			A[i] = 0
	for i in range(N - 2, -1, -1):
		if A[i] == 1 and A[i + 1] == 0:
			A[i] = 0
	A.sort()
	if A[-1 - -N // 2] == 0:
		Ans[qu] = 'yes'
print('\n'.join(Ans))


import sys

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	(N, K) = MAP()
	A = LIST()
	if not A.count(K):
		print('no')
		continue
	if N == 1:
		print('yes')
		continue
	ok = False
	for i in range(N):
		if A[i] >= K:
			for j in range(i + 1, min(i + 3, N)):
				if A[j] >= K:
					ok = True
					break
		if ok:
			break
	if ok:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if a.count(k) == n:
		print('yes')
		continue
	if k not in a:
		print('no')
		continue
	l = []
	for t in a:
		if t >= k:
			l.append(1)
		else:
			l.append(0)
	q = False
	for i in range(n):
		if l[i]:
			if l[i - 1] and i:
				q = True
			if l[i - 2] and i > 1:
				q = True
	print('yes' if q else 'no')


import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import bisect_left, bisect_right
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string
import heapq as h, time
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')

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

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

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

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def getBin():
	return list(map(int, list(input())))

def isInt(s):
	return '0' <= s[0] <= '9'

def ceil_(a, b):
	return a // b + (a % b > 0)
MOD = 10 ** 9 + 7
y = 'yes'
n = 'no'

def solve():
	global flag
	(N, K) = getInts()
	A = getInts()
	if K not in set(A):
		return n
	if N == 1:
		return y
	above = below = 0
	for (i, a) in enumerate(A):
		if a < K:
			below += 1
		else:
			above += 1
		if below > above:
			above = below = 0
		if above > below and above + below > 1:
			return y
	return n
for _ in range(getInt()):
	print(solve())


import sys
import os
import heapq
import math
try:
	path = './file/input.txt'
	if os.path.exists(path):
		sys.stdin = open(path, 'r')
except:
	pass
t = int(input())

def printd(value):
	pass

def run(n, k, s):
	i = 0
	have = False
	isSuccess = True if len(s) == 1 and s[0] == k else False
	while i < n:
		if s[i] == k:
			have = True
		if i < n - 1 and s[i] >= k and (s[i + 1] >= k):
			isSuccess = True
		if i < n - 2 and s[i] >= k and (s[i + 2] >= k):
			isSuccess = True
		i += 1
	return isSuccess and have

def case():
	arr = list(map(int, input().split(' ')))
	(n, k) = (arr[0], arr[1])
	s = list(map(int, input().split(' ')))
	print('yes' if run(n, k, s) else 'no')
for _ in range(t):
	case()


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')
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split(' '))
	li = [int(i) for i in input().split(' ')]
	a = False
	b = False
	cb = 0
	for (p, i) in enumerate(li):
		if i == k:
			a = True
		if i >= k:
			if p > 1:
				if li[p - 2] >= k:
					b = True
			cb += 1
			if cb >= 2:
				b = True
		else:
			cb = 0
	if a and b or (n == 1 and a):
		print('yes')
	else:
		print('no')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	now = -1
	if k not in a:
		print('no')
		continue
	if len(a) == 1:
		print('yes')
		continue
	for i in a:
		if i == k and now >= 0:
			print('yes')
			break
		if i >= k:
			if now < 0:
				now = 1
			else:
				print('yes')
				break
		else:
			now -= 1
	else:
		now = -1
		for i in reversed(a):
			if i == k and now >= 0:
				print('yes')
				break
			if i >= k:
				now = max(1, now + 1)
			else:
				now -= 1
		else:
			print('no')


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	c = a.count(k)
	m = max(a)
	flag = 'no'
	if k not in a:
		print('no')
		continue
	if k == m and c == 1:
		if n == 1:
			flag = 'yes'
	elif k == m and c > 1:
		for x in range(1, n):
			if a[x - 1] == a[x] == k:
				flag = 'yes'
				break
		for x in range(2, n):
			if a[x - 2] == a[x] == k:
				flag = 'yes'
				break
	else:
		for x in range(1, n):
			if a[x - 1] >= k and a[x] >= k:
				flag = 'yes'
				break
		for x in range(2, n):
			if a[x - 2] >= k and a[x] >= k:
				flag = 'yes'
				break
	print(flag)


import sys
input = lambda : sys.stdin.readline().rstrip()
T = int(input())
for _ in range(T):
	(N, K) = list(map(int, input().split()))
	A = [int(a) for a in input().split()]
	if K not in A:
		print('no')
		continue
	if N == 1 or (A[0] >= K and A[1] >= K):
		print('yes')
		continue
	for i in range(2, N):
		if A[i] >= K and (A[i - 1] >= K or A[i - 2] >= K):
			print('yes')
			break
	else:
		print('no')
		continue


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

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

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def check(idx):
	up = down = 0
	(a1, a2, a3) = sorted(a[idx:idx + 3])
	return a1 <= a2 <= a3 and a2 >= k
t = INT()
while t != 0:
	(n, k) = MAP()
	a = LIST()
	if k in a:
		flag = 1
	else:
		flag = 0
	if flag == 1:
		for patchStart in range(n - 2):
			if check(patchStart):
				flag = 1
				break
			else:
				flag = 0
				continue
		if n == 2:
			foo = 0
			for el in a:
				if el >= k:
					foo += 1
			if foo == 2:
				print('yes')
			else:
				print('no')
		elif flag == 0:
			print('no')
		else:
			print('yes')
	else:
		print('no')
	t -= 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ar = list(map(int, input().split()))
	flag = False
	for i in range(1, n):
		if ar[i] >= k and ar[i - 1] >= k:
			flag = True
			break
		if ar[i] >= k and ar[i - 2] >= k and (i >= 2):
			flag = True
			break
	if k not in ar:
		flag = False
	if n == 1 and ar[0] == k:
		flag = True
	if flag:
		print('yes')
	else:
		print('no')


import sys
input = sys.stdin.readline

class BIT:

	def __init__(self, n):
		self.n = n
		self.data = [0] * (n + 1)
		self.el = [0] * (n + 1)

	def sum(self, i):
		s = 0
		while i > 0:
			s += self.data[i]
			i -= i & -i
		return s

	def add(self, i, x):
		self.el[i] += x
		while i <= self.n:
			self.data[i] += x
			i += i & -i

	def get(self, i, j=None):
		if j is None:
			return self.el[i]
		return self.sum(j) - self.sum(i)

	def lowerbound(self, s):
		x = 0
		y = 0
		for i in range(self.n.bit_length(), -1, -1):
			k = x + (1 << i)
			if k <= self.n and y + self.data[k] < s:
				y += self.data[k]
				x += 1 << i
		return x + 1
for _ in range(int(input())):
	(N, K) = map(int, input().split())
	a = list(map(int, input().split()))
	c = a.count(K)
	if c == N:
		print('yes')
		continue
	if c == 0:
		print('no')
		continue
	for i in range(N):
		if a[i] < K:
			a[i] = -1
		else:
			a[i] = 1
	cs = [0] * (N + 1)
	for i in range(N):
		cs[i + 1] = cs[i] + a[i]
	bias = max(0, -min(cs)) + 2
	fwk = BIT(N + 5)
	for x in cs:
		if fwk.sum(x + bias - 1) > 1:
			print('yes')
			break
		fwk.add(x + bias, 1)
	else:
		print('no')


import sys
import math
t = int(input())
for i in range(t):
	tt = input().split(' ')
	n = int(tt[0])
	k = int(tt[1])
	a = input().split(' ')
	a = [int(aa) for aa in a]
	if k not in a:
		print('no')
		continue
	flag = 0
	count = 0
	if n == 1 and a[0] == k:
		print('yes')
		continue
	for j in a:
		if j >= k:
			if count > 0:
				flag = 1
				break
			count = 2
		else:
			count -= 1
	if flag == 1:
		print('yes')
	else:
		print('no')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = [0] + list(map(int, input().split())) + [0]
	if n == 1:
		print('yes' if a[1] == k else 'no')
		continue
	if k not in a:
		print('no')
		continue
	for i in range(1, n + 1):
		if (a[i - 1] >= k) + (a[i] >= k) + (a[i + 1] >= k) >= 2:
			print('yes')
			break
	else:
		print('no')


mod = 1000000007
eps = 10 ** (-9)

def main():
	import sys
	input = sys.stdin.buffer.readline
	for _ in range(int(input())):
		(N, K) = map(int, input().split())
		A = list(map(int, input().split()))
		if K not in A:
			print('no')
			continue
		if N == 1:
			print('yes')
			continue
		ok = 0
		for i in range(1, N):
			if A[i] >= K:
				if A[i - 1] >= K:
					ok = 1
					break
				if i - 2 >= 0:
					if A[i - 2] >= K:
						ok = 1
						break
		if ok:
			print('yes')
		else:
			print('no')
main()


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in a:
		print('no')
	else:
		odp = 'no'
		if n == 1:
			odp = 'yes'
		elif n == 2:
			if not min(a) < k:
				odp = 'yes'
		else:
			for i in range(n - 2):
				cyk = 0
				cyk += 1 if a[i] >= k else 0
				cyk += 1 if a[i + 1] >= k else 0
				cyk += 1 if a[i + 2] >= k else 0
				if cyk >= 2:
					odp = 'yes'
					break
		print(odp)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l.append(0)
	l.append(0)
	flag = 0
	if k not in l:
		print('no')
	elif n == 1:
		if l[0] != k:
			print('no')
		else:
			print('yes')
	else:
		for i in range(n):
			if l[i] >= k:
				if l[i + 1] >= k or l[i + 2] >= k:
					flag = 1
		if flag == 1:
			print('yes')
		else:
			print('no')


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		(n, k) = map(int, input().split())
		aa = [int(a) for a in input().split()] + [0, 0]
		hask = False
		close = False
		for i in range(n):
			if aa[i] == k:
				hask = True
			if aa[i] >= k and (aa[i + 1] >= k or aa[i + 2] >= k):
				close = True
		if hask and (n == 1 or close):
			print('yes')
		else:
			print('no')
	q = int(input())
	for i in range(q):
		solve()
main()


from collections import Counter, defaultdict, deque
import sys
input = sys.stdin.readline

def mid(a, b, c):
	return a + b + c - min(a, b, c) - max(a, b, c)

def solve():
	(n, k) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	if k not in arr:
		print('no')
		return
	if n < 3:
		if min(arr) == k:
			print('yes')
		else:
			print('no')
		return
	for i in range(n - 2):
		(a, b, c) = (arr[i], arr[i + 1], arr[i + 2])
		if mid(a, b, c) >= k:
			print('yes')
			return
	print('no')
tt = int(input())
for test in range(tt):
	solve()


import collections
import time
import os
import sys
import bisect
import heapq
from typing import List

def solve(N, K, A):
	A = [0 if v < K else 2 if v > K else 1 for v in A]
	if A.count(1) == 0:
		return False
	elif N == 1:
		return True
	else:
		for i in range(N):
			if A[i] > 0 and any((A[j] > 0 for j in range(i + 1, min(i + 3, N)))):
				return True
	return False
T = int(input())
ans = []
for ti in range(T):
	(N, K) = map(int, input().split())
	A = [int(x) for x in input().split()]
	ans.append('yes' if solve(N, K, A) else 'no')
print('\n'.join(ans))


t = int(input())
for u in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in a:
		print('no')
		continue
	if n == 1:
		print('yes')
		continue
	if n == 2:
		if (a[0] + a[1]) / 2 >= k:
			print('yes')
			continue
	x = y = z = 0
	ok = 0
	for i in range(n):
		if a[i] > k:
			x += 1
		elif a[i] < k:
			y += 1
		else:
			z += 1
		if i >= 3:
			if a[i - 3] > k:
				x -= 1
			elif a[i - 3] < k:
				y -= 1
			else:
				z -= 1
		if i >= 2:
			if y >= 2:
				continue
			ok = 1
			print('yes')
			break
	if not ok:
		print('no')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	has = False
	prop = n == 1
	for i in range(n):
		if a[i] == k:
			has = True
		if a[i] >= k and i > 0:
			if a[i - 1] >= k:
				prop = True
			if i > 1 and a[i - 2] >= k:
				prop = True
	print('yes' if has and prop else 'no')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in a:
		print('no')
		continue
	if n == 1:
		print('yes')
		continue
	flag = False
	for i in range(n - 1):
		if a[i] >= k and a[i + 1] >= k:
			flag = True
	for i in range(n - 2):
		if a[i] >= k and a[i + 2] >= k:
			flag = True
	if flag:
		print('yes')
	else:
		print('no')


from sys import stdin
import heapq
for case in range(int(stdin.readline())):
	(n, k) = [int(x) for x in stdin.readline().split()]
	a = [int(x) for x in stdin.readline().split()]
	if not k in a:
		print('no')
		continue
	elif n == 1 and a[0] == k:
		print('yes')
	else:
		leftmost = n
		rightmost = -1
		diff = [0]
		for x in range(n):
			if a[x] == k:
				leftmost = min(leftmost, x)
				rightmost = max(rightmost, x)
			if a[x] < k:
				diff.append(diff[-1] - 1)
			else:
				diff.append(diff[-1] + 1)
		rDiff = [0]
		for x in range(n - 1, -1, -1):
			if a[x] < k:
				rDiff.append(rDiff[-1] - 1)
			else:
				rDiff.append(rDiff[-1] + 1)
		rDiff.reverse()
		q = []
		rQ = [100000000000]
		q2 = []
		rQ2 = [100000000000]
		for (i, x) in enumerate(diff[1:]):
			heapq.heappush(q, (-x, i))
			if i < rightmost:
				heapq.heappush(q2, (-x, i))
		gude = False
		for x in range(n):
			while q[0][1] <= x:
				heapq.heappop(q)
				if not q:
					break
			if q2:
				while q2[0][1] <= x:
					heapq.heappop(q2)
					if not q2:
						break
			if a[x] == k:
				if q:
					if -q[0][0] >= diff[x + 1]:
						gude = True
						break
				if -rQ[0] >= rDiff[x]:
					gude = True
					break
			elif a[x] > k:
				if x > leftmost:
					if q:
						if -q[0][0] >= diff[x + 1]:
							gude = True
							break
				elif q2:
					if -q2[0][0] >= diff[x + 1]:
						gude = True
						break
				if x < rightmost:
					if -rQ[0] >= rDiff[x]:
						gude = True
						break
				elif -rQ2[0] >= rDiff[x]:
					gude = True
					break
			heapq.heappush(rQ, -rDiff[x])
			if i > leftmost:
				heapq.heappush(rQ2, -rDiff[x])
		if gude:
			print('yes')
		else:
			print('no')


import math
from math import gcd

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

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

def i():
	return int(input())

def si():
	return input()

def pYes():
	print('YES')

def pNo():
	print('NO')

def plist(l):
	print(''.join(l))
t = int(input())
for i in range(t):
	(n, k) = r()
	a = l()
	f = False
	for i in range(1, n):
		if a[i] >= k and a[i - 1] >= k:
			f = True
			break
		if a[i] >= k and a[i - 2] >= k and (i >= 2):
			f = True
			break
	if k not in a:
		f = False
	if n == 1 and a[0] == k:
		f = True
	if f:
		print('yes')
	else:
		print('no')


import sys
input = sys.stdin.readline
for f in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	poss = 0
	lastk = -1
	lastb = 0
	mb = -1
	i = 0
	big = 0
	if n == 1 and a[0] == k:
		poss = 1
	while i < n and poss == 0:
		if a[i] == k:
			if mb >= 0:
				poss = 1
			else:
				mb = 1
				lastk = i
				lastb = 0
		elif a[i] > k:
			mb += 1
			if mb > 0:
				big = 1
			if mb < 1:
				mb = 1
			lastb += 1
			if lastb >= 0 and lastk >= 0:
				poss = 1
		else:
			mb -= 1
			lastb -= 1
		i += 1
	if big == 1 and lastk >= 0:
		poss = 1
	if poss == 1:
		print('yes')
	else:
		print('no')


from array import array
import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	fnd = False
	bgr = False
	for i in range(0, n):
		if arr[i] == k:
			fnd = True
	for i in range(1, n - 1):
		cnt = 0
		if arr[i] >= k:
			cnt += 1
		if arr[i - 1] >= k:
			cnt += 1
		if arr[i + 1] >= k:
			cnt += 1
		if cnt >= 2:
			bgr = True
	if n == 1 and arr[0] == k:
		print('yes')
	elif n == 2 and min(arr[0], arr[1]) == k:
		print('yes')
	elif bgr and fnd:
		print('yes')
	else:
		print('no')


from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(*a,) = map(int, input().split())
	if k not in a:
		print('No')
		continue
	if n == 1:
		print('Yes')
		continue
	for i in range(n - 1):
		if a[i] >= k and a[i + 1] >= k:
			print('Yes')
			break
	else:
		for i in range(n - 2):
			if a[i] >= k and a[i + 2] >= k:
				print('Yes')
				break
		else:
			print('No')


import sys
input = sys.stdin.readline

def solve():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in set(a):
		print('NO')
		return
	if n == 1:
		if a[0] == k:
			print('YES')
		else:
			print('NO')
		return
	for i in range(n):
		if i + 1 < n:
			if min(a[i], a[i + 1]) >= k:
				print('YES')
				return
		if i + 2 < n:
			if sorted([a[i], a[i + 1], a[i + 2]])[1] >= k:
				print('YES')
				return
	print('NO')
	return
for nt in range(int(input())):
	solve()


import sys

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
from math import *
import copy
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

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

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

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

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

def lcm(p, q):
	return p * q // gcd(p, q)

def gcda(a):
	g = a[0]
	for i in range(1, len(a)):
		g = gcd(g, a[i])
	return g
MAXN = 2 * 10 ** 5 + 10
spf = [0 for i in range(MAXN)]

def 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(sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def fact(x):
	ret = {}
	while x != 1:
		if spf[x] not in ret:
			ret[spf[x]] = 1
		else:
			ret[spf[x]] += 1
		x = x // spf[x]
	return ret
t = fi()
while t > 0:
	t -= 1
	(n, k) = mi()
	a = li()
	if k not in a:
		print('no')
		continue
	flag = 0
	if flag == 0:
		prev = -1
		for i in range(n):
			if a[i] >= k:
				if prev == -1:
					prev = i
				elif -prev + i <= 2:
					flag = 1
					break
				prev = i
	print('yes' if flag == 1 or n == 1 else 'no')


t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	a = []
	hasa = False
	for i in input().split():
		x = int(i)
		if x == k:
			hasa = True
		a.append(x >= k)
	if not hasa:
		print('no')
		continue
	if n == 1:
		print('yes')
		continue
	ans = a[-1] and a[-2]
	for i in range(n - 2):
		if a[i] and (a[i + 1] or a[i + 2]):
			ans = True
			break
		if ans:
			break
	print('yes' if ans else 'no')


import math as mt
import sys, string
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def lcm(a, b):
	return a * b // mt.gcd(a, b)
t = I()
for _ in range(t):
	(n, k) = M()
	l = L()
	r = 0
	if n == 1:
		if l[0] == k:
			print('yes')
		else:
			print('no')
	else:
		for i in range(n):
			if l[i] > k:
				l[i] = k
			elif l[i] == k:
				r = 1
		if r:
			r = 0
			for i in range(n - 2):
				if sorted(l[i:i + 3])[1] == k:
					r = 1
					break
			if r == 0:
				for i in range(n - 1):
					if sorted(l[i:i + 2])[0] == k:
						r = 1
						break
			if r:
				print('yes')
			else:
				print('no')
		else:
			print('no')


def main():
	t = int(input())
	allAns = []
	for _ in range(t):
		(n, k) = readIntArr()
		a = readIntArr()
		b = []
		for x in a:
			if x < k:
				b.append(0)
			elif x == k:
				b.append(1)
			else:
				b.append(2)
		ans = 'no'
		if 1 not in b:
			allAns.append('no')
			continue
		if n == 1 and b[0] == 1:
			ans = 'yes'
		elif n > 1:
			for i in range(n - 1):
				temp = [b[i], b[i + 1]]
				temp.sort()
				if temp == [1, 1] or temp == [1, 2] or temp == [2, 2]:
					ans = 'yes'
					break
			for i in range(n - 2):
				temp = [b[i], b[i + 1], b[i + 2]]
				temp.sort()
				if temp == [0, 1, 1] or temp == [0, 1, 2] or temp == [0, 2, 2]:
					ans = 'yes'
					break
		allAns.append(ans)
	multiLineArrayPrint(allAns)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]
inf = float('inf')
MOD = 10 ** 9 + 7
main()


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	flag = 0
	for i in A:
		if i == k:
			flag = 1
			break
	if flag == 0:
		print('no')
	elif n < 3:
		if n == 1 or (n == 2 and min(A) == k):
			print('yes')
		else:
			print('no')
	else:
		for i in range(n - 2):
			v = 0
			if A[i] >= k:
				v = v + 1
			if A[i + 1] >= k:
				v = v + 1
			if A[i + 2] >= k:
				v = v + 1
			if v >= 2:
				flag = 0
				break
		if flag == 0:
			print('yes')
		else:
			print('no')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	b = [0] * n
	flag = False
	for i in range(n):
		if a[i] < k:
			b[i] = 0
		elif a[i] == k:
			b[i] = 1
			flag = True
		else:
			b[i] = 2
	if not flag:
		print('no')
		continue
	flag = False
	for i in range(n):
		for j in range(i + 1, i + 3):
			if j < n and b[i] * b[j] > 0:
				flag = True
	if flag or n == 1:
		print('yes')
	else:
		print('no')


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(n, k) = I()
	l = I() + [0, 0]
	a = 0
	b = 0
	if n == 1 and l[0] == k:
		print('YES')
	else:
		for i in range(n):
			if l[i] == k:
				a = 1
			if l[i] >= k and (l[i + 1] >= k or l[i + 2] >= k):
				b = 1
		if a and b:
			print('yes')
		else:
			print('no')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	flag = 0
	for i in range(n):
		if a[i] > k:
			a[i] = 2
		elif a[i] == k:
			a[i] = 1
		else:
			a[i] = 0
		if a[i] == 1:
			flag = 1
	if flag == 0:
		print('no')
		continue
	if n == 1:
		print('yes')
		continue
	flag = 0
	for i in range(n):
		j = i + 1
		while j < n and j - i <= 2:
			if a[i] and a[j]:
				flag = 1
				break
			j += 1
		if flag == 1:
			break
	if flag == 1:
		print('yes')
	else:
		print('no')


import math
import sys
from collections import defaultdict, Counter, deque, OrderedDict
import bisect
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]
from itertools import accumulate, groupby
import sys
import heapq
for _ in range(int(input())):
	(n, k) = ilele()
	A = alele()
	i = 0
	f = 0
	if k not in A:
		print('NO')
	elif n == 1:
		if k == A[0]:
			print('YES')
		else:
			print('NO')
	elif A[0] >= k and A[1] >= k:
		print('YES')
	else:
		f = 0
		for i in range(1, n):
			if A[i] == k and i != n - 1:
				if A[i - 1] >= k or A[i + 1] >= k:
					f = 1
					break
			if i >= 2:
				if A[i] >= k and (A[i - 1] >= k or A[i - 2] >= k):
					f = 1
					break
		if f == 1:
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	arr.append(-1)
	arr.append(-1)
	if k not in arr:
		print('no')
		continue
	elif n == 1:
		if arr[0] == k:
			print('yes')
			continue
	flag = 0
	for i in range(n):
		if arr[i] >= k:
			if arr[i + 1] >= k or arr[i + 2] >= k:
				flag = 1
	if flag:
		print('yes')
	else:
		print('no')


import sys
input = sys.stdin.readline

def main():
	test = int(input())
	for _ in range(test):
		(n, k) = map(int, input().split())
		ara = [int(x) for x in input().split()]
		ara.append(-1)
		isK = False
		for num in ara:
			if num == k:
				isK = True
				break
		if n == 1:
			interval = True
		else:
			interval = False
		for idx in range(0, n - 1):
			if ara[idx] >= k:
				if ara[idx + 1] >= k or ara[idx + 2] >= k:
					interval = True
					break
		if isK and interval:
			print('yes')
		else:
			print('no')
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in a:
		print('no')
		continue
	res = False
	for (i, x) in enumerate(a):
		if x >= k:
			if i - 1 >= 0 and a[i - 1] >= k:
				res = True
				break
			if i + 1 < n and a[i + 1] >= k:
				res = True
				break
	if res:
		print('yes')
		continue
	if a == [k]:
		print('yes')
		continue
	idx = [i for i in range(n) if a[i] >= k]
	for j in range(len(idx) - 1):
		if idx[j] + 2 == idx[j + 1]:
			res = True
			break
	if res:
		print('yes')
		continue
	print('no')


import sys
input = sys.stdin.readline
from itertools import accumulate
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in a:
		print('no')
		continue
	if n == 1:
		print('yes')
		continue
	for i in range(1, n):
		if a[i] >= k and a[i - 1] >= k:
			print('yes')
			break
		if i >= 2:
			if a[i] >= k and a[i - 2] >= k:
				print('yes')
				break
	else:
		print('no')


import sys
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def solve(a):
	n = len(a)

def main():
	ntc = next(ints)
	for tc in range(1, ntc + 1):
		(n, k) = (next(ints) for i in range(2))
		a = (next(ints) for i in range(n))
		a = [1 if x > k else -1 if x < k else 0 for x in a]
		ans = 0 in a
		ans = ans and (len(a) == 1 or any((a[i] >= 0 and a[i + 1] >= 0 for i in range(n - 1))) or any((a[i] >= 0 and a[i + 2] >= 0 for i in range(n - 2))))
		print('yes' if ans else 'no')
	return
main()


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, K, A):
	assert len(A) == N
	if K not in A:
		return 'no'
	if len(A) == 1:
		assert A[0] == K
		return 'yes'
	for (x, y) in zip(A, A[1:]):
		if x == K and y >= K or (y == K and x >= K):
			return 'yes'
		if x > K and y > K:
			return 'yes'
		assert x < K or y < K
	for xyz in zip(A, A[1:], A[2:]):
		(x, y, z) = sorted(xyz)
		if y == K:
			return 'yes'
		if y > K:
			return 'yes'
		assert x < K and y < K
	return 'no'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N, K) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, K, A)
	print(ans)


import sys
input = sys.stdin.readline
for cs in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	if k not in a:
		print('no')
	else:
		ok = False
		for i in range(n):
			if a[i] >= k:
				for j in range(max(0, i - 2), min(n, i + 3)):
					if i != j:
						if a[j] >= k:
							ok = True
		if n == 1 and a[0] == k:
			ok = True
		if ok:
			print('yes')
		else:
			print('no')


import sys
from heapq import heappop
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = [0] + list(map(int, input().split())) + [0]
	if n == 1:
		print('yes' if a[1] == k else 'no')
		continue
	if k not in a:
		print('no')
		continue
	(lr, rl) = ([0] * (n + 2), [0] * (n + 2))
	hq_lr = []
	for i in range(1, n + 1):
		lr[i] = lr[i - 1] + (1 if a[i] >= k else -1)
		hq_lr.append((-lr[i], i))
	for i in range(n, 0, -1):
		rl[i] = rl[i + 1] + (1 if a[i] >= k else -1)
	rl_max = -10 ** 18
	hq_lr.sort()
	for i in range(1, n + 1):
		while hq_lr and hq_lr[0][1] <= i:
			heappop(hq_lr)
		if a[i] >= k and (hq_lr and lr[i] <= -hq_lr[0][0] or rl[i] <= rl_max):
			print('yes')
			break
		if rl_max < rl[i]:
			rl_max = rl[i]
	else:
		print('no')


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(i) for i in input().split()]
	chk = [int(i >= k) for i in a]
	flag = 0
	if k in a:
		if len(a) == 1:
			print('yes')
		else:
			for i in range(n - 1):
				if chk[i] == 1 and (chk[i + 1] == 1 or chk[min(n - 1, i + 2)] == 1):
					flag = 1
					break
			print(['no', 'yes'][flag])
	else:
		print('no')


import sys
input = sys.stdin.readline
import heapq
import copy
import math
import decimal
from decimal import *

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())

class Node:

	def _init_(self, val):
		self.data = val
		self.left = None
		self.right = None

class fen_tree:

	def __init__(self, list):
		self.array = [0] + list
		for idx in range(1, len(self.array)):
			idx2 = idx + (idx & -idx)
			if idx2 < len(self.array):
				self.array[idx2] += self.array[idx]

	def prefix_query(self, idx):
		result = 0
		while idx:
			result += self.array[idx]
			idx -= idx & -idx
		return result

	def prints(self):
		print(self.array)
		return

	def range_query(self, from_idx, to_idx):
		return self.prefix_query(to_idx) - self.prefix_query(from_idx - 1)

	def update(self, idx, add):
		while idx < len(self.array):
			self.array[idx] += add
			idx += idx & -idx

def pre_sum(arr):
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p

def pre_back(arr):
	p = [0]
	for i in arr:
		p.append(p[-1] + i)
	p.pop(0)
	return p

def bin_search(arr, l, r, val):
	if arr[r] <= val:
		return r + 1
	if r - l < 2:
		if arr[l] > val:
			return l
		else:
			return r
	mid = int((l + r) / 2)
	if arr[mid] <= val:
		return bin_search(arr, mid, r, val)
	else:
		return bin_search(arr, l, mid, val)

def search_leftmost(arr, val):

	def helper(arr, l, r, val):
		print(l, r)
		if arr[l] == val:
			return l
		if r - l <= 1:
			if arr[r] == val:
				return r
			else:
				print('not found')
				return
		mid = int((r + l) / 2)
		if arr[mid] >= val:
			return helper(arr, l, mid, val)
		else:
			return helper(arr, mid, r, val)
	return helper(arr, 0, len(arr) - 1, val)

def search_rightmost(arr, val):

	def helper(arr, l, r, val):
		print(l, r)
		if arr[r] == val:
			return r
		if r - l <= 1:
			if arr[l] == val:
				return r
			else:
				print('not found')
				return
		mid = int((r + l) / 2)
		if arr[mid] > val:
			return helper(arr, l, mid, val)
		else:
			return helper(arr, mid, r, val)
	return helper(arr, 0, len(arr) - 1, val)

def preorder_postorder(root, paths, parent, left, level):
	l = 0
	queue = [root]
	while queue != []:
		node = queue[-1]
		flag = 0
		for i in paths[node]:
			if i != parent[node] and level[i] == sys.maxsize:
				parent[i] = node
				level[i] = level[node] + 1
				flag = 1
				queue.append(i)
		if flag == 0:
			left[parent[node]] += 1 + left[node]
			queue.pop()
	return [parent, left, level]

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	for test in range(tests):
		[n, k] = inlt()
		a = inlt()
		flag = 0
		found = 0
		if len(a) == 1 and a[0] == k:
			print('yes')
			continue
		for i in range(len(a)):
			if a[i] == k:
				found = 1
				for j in range(i, n - 1):
					if a[j] >= k and a[j + 1] >= k:
						flag = 1
						break
					if j + 2 < n and a[j] >= k and (a[j + 1] <= k) and (a[j + 2] >= k):
						flag = 1
						break
				for j in range(i, 0, -1):
					if a[j] >= k and a[j - 1] >= k:
						flag = 1
						break
					if j - 2 >= 0 and a[j] >= k and (a[j - 1] <= k) and (a[j - 2] >= k):
						flag = 1
						break
				if flag == 1:
					break
			if found == 1:
				break
		if flag == 1:
			print('yes')
		else:
			print('no')
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	l.append(-1)
	l.append(-1)
	if k not in l:
		print('No')
		continue
	if n == 1 and l[0] == k:
		print('Yes')
		continue
	f = 0
	for i in range(n):
		if l[i] >= k and (l[i + 1] >= k or l[i + 2] >= k):
			f = 1
	if f == 1:
		print('Yes')
	else:
		print('No')


from sys import stdin
input = stdin.buffer.readline
T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	ls = list(map(int, input().split()))
	if n == 1:
		print('yes' if ls[0] == k else 'no')
		continue
	(c1, c2) = (0, 0)
	for (i, u) in enumerate(ls):
		if u == k:
			c1 = 1
		if i > 0 and ls[i - 1] >= k and (u >= k):
			c2 = 1
		if i > 1 and ls[i - 2] >= k and (u >= k):
			c2 = 1
	print('yes' if c1 and c2 else 'no')


import sys
import math
from collections import defaultdict
t = int(sys.stdin.readline())
for _ in range(t):
	dic = defaultdict(list)
	(n, k) = map(int, sys.stdin.readline().split())
	pos = []
	arr = list(map(int, sys.stdin.readline().split()))
	ans = True
	if n == 1:
		if arr[0] == k:
			print('yes')
		else:
			print('no')
		continue
	x = 0
	for i in range(n):
		if arr[i] == k:
			x = 1
	if x == 1:
		for i in range(n - 1):
			if arr[i] >= k and arr[i + 1] >= k:
				ans = False
				break
		if ans:
			for i in range(n - 2):
				if arr[i] >= k and arr[i + 2] >= k:
					ans = False
					break
	if ans:
		print('no')
	else:
		print('yes')


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))
	Query.append((N, K, A))
for (N, K, A) in Query:
	Inds = []
	exists = False
	for (i, a) in enumerate(A):
		if a == K:
			exists = True
		if a >= K:
			Inds.append(i)
	if not exists:
		ok = False
	elif N == 1:
		ok = True
	else:
		ok = False
		for ind in Inds:
			if ind < N - 1 and A[ind + 1] >= A[ind]:
				ok = True
			elif ind > 0 and A[ind - 1] >= A[ind]:
				ok = True
			elif ind > 1 and A[ind - 2] >= A[ind]:
				ok = True
			elif ind < N - 2 and A[ind + 2] >= A[ind]:
				ok = True
	print('yes' if ok else 'no')


import sys
from math import ceil, sqrt
read = sys.stdin.buffer.readline
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())

def isp(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
primes = []
for _ in range(cin()):
	(n, k) = mi()
	a = li()
	flag = False
	if k not in a:
		print('no')
		continue
	if n == 1 and a[0] == k:
		flag = True
	if n == 2 and sum(a) >= 2 * k:
		flag = True
	if flag:
		print('yes')
		continue
	for (i1, i2, i3) in zip(a, a[1:], a[2:]):
		if (i1 >= k) + (i2 >= k) + (i3 >= k) > 1:
			flag = True
			break
	if flag:
		print('yes')
	else:
		print('no')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	l = list(map(int, sys.stdin.readline().split()))
	for i in range(n):
		if l[i] == k:
			l[i] = 1
		elif l[i] < k:
			l[i] = 0
		else:
			l[i] = 2
	if l.count(1) == 0:
		print('NO')
	elif n == 1:
		print('YES')
	else:
		flag = False
		for i in range(n):
			for j in range(i + 1, min(n, i + 3)):
				if l[i] > 0 and l[j] > 0:
					flag = True
		if flag:
			print('YES')
		else:
			print('NO')


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby

def Golf():
	(*a,) = map(int, open(0))

def I():
	return int(input())

def S_():
	return input()

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

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

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

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def bit_combination(n, base=2):
	rt = []
	for tb in range(base ** n):
		s = [tb // base ** bt % base for bt in range(n)]
		rt += [s]
	return rt

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

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['YES', 'NO']
Yn = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(1, 0), (-1, 0), (0, 1), (0, -1)]
EightNb = [(1, 0), (-1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('EWNS', FourNb))
l_alp = string.ascii_lowercase
input = lambda : sys.stdin.readline().rstrip()

class Tree:

	def __init__(self, inp_size=None, ls=None, init=True, index=0):
		self.LCA_init_stat = False
		self.ETtable = []
		if init:
			if ls == None:
				self.stdin(inp_size, index=index)
			else:
				self.size = len(ls) + 1
				(self.edges, _) = GI(self.size, self.size - 1, ls, index=index)
		return

	def stdin(self, inp_size=None, index=1):
		if inp_size == None:
			self.size = int(input())
		else:
			self.size = inp_size
		(self.edges, _) = GI(self.size, self.size - 1, index=index)
		return

	def listin(self, ls, index=0):
		self.size = len(ls) + 1
		(self.edges, _) = GI(self.size, self.size - 1, ls, index=index)
		return

	def __str__(self):
		return str(self.edges)

	def dfs(self, x, func=lambda prv, nx, dist: prv + dist, root_v=0):
		q = deque()
		q.append(x)
		v = [-1] * self.size
		v[x] = root_v
		while q:
			c = q.pop()
			for (nb, d) in self.edges[c]:
				if v[nb] == -1:
					q.append(nb)
					v[nb] = func(v[c], nb, d)
		return v

	def EulerTour(self, x):
		q = deque()
		q.append(x)
		self.depth = [None] * self.size
		self.depth[x] = 0
		self.ETtable = []
		self.ETdepth = []
		self.ETin = [-1] * self.size
		self.ETout = [-1] * self.size
		cnt = 0
		while q:
			c = q.pop()
			if c < 0:
				ce = ~c
			else:
				ce = c
				for (nb, d) in self.edges[ce]:
					if self.depth[nb] == None:
						q.append(~ce)
						q.append(nb)
						self.depth[nb] = self.depth[ce] + 1
			self.ETtable.append(ce)
			self.ETdepth.append(self.depth[ce])
			if self.ETin[ce] == -1:
				self.ETin[ce] = cnt
			else:
				self.ETout[ce] = cnt
			cnt += 1
		return

	def LCA_init(self, root):
		self.EulerTour(root)
		self.st = SparseTable(self.ETdepth, init_func=min, init_idl=inf)
		self.LCA_init_stat = True
		return

	def LCA(self, root, x, y):
		if self.LCA_init_stat == False:
			self.LCA_init(root)
		(xin, xout) = (self.ETin[x], self.ETout[x])
		(yin, yout) = (self.ETin[y], self.ETout[y])
		a = min(xin, yin)
		b = max(xout, yout, xin, yin)
		id_of_min_dep_in_et = self.st.query_id(a, b + 1)
		return self.ETtable[id_of_min_dep_in_et]

class SparseTable:

	def __init__(self, ls, init_func=min, init_idl=float('inf')):
		self.func = init_func
		self.idl = init_idl
		self.size = len(ls)
		self.N0 = self.size.bit_length()
		self.table = [ls[:]]
		self.index = [list(range(self.size))]
		self.lg = [0] * (self.size + 1)
		for i in range(2, self.size + 1):
			self.lg[i] = self.lg[i >> 1] + 1
		for i in range(self.N0):
			tmp = [self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) for j in range(self.size)]
			tmp_id = [self.index[i][j] if self.table[i][j] == self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) else self.index[i][min(j + (1 << i), self.size - 1)] for j in range(self.size)]
			self.table += [tmp]
			self.index += [tmp_id]

	def query(self, l, r):
		if r > self.size:
			r = self.size
		N = self.lg[r - l]
		return self.func(self.table[N][l], self.table[N][max(0, r - (1 << N))])

	def query_id(self, l, r):
		if r > self.size:
			r = self.size
		N = self.lg[r - l]
		(a, b) = (self.index[N][l], self.index[N][max(0, r - (1 << N))])
		if self.table[0][a] == self.func(self.table[N][l], self.table[N][r - (1 << N)]):
			b = a
		return b

	def __str__(self):
		return str(self.table[0])

	def print(self):
		for i in self.table:
			print(*i)

class Comb:

	def __init__(self, n, mo=10 ** 9 + 7):
		self.fac = [0] * (n + 1)
		self.inv = [1] * (n + 1)
		self.fac[0] = 1
		self.fact(n)
		for i in range(1, n + 1):
			self.fac[i] = i * self.fac[i - 1] % mo
			self.inv[n] *= i
			self.inv[n] %= mo
		self.inv[n] = pow(self.inv[n], mo - 2, mo)
		for i in range(1, n):
			self.inv[n - i] = self.inv[n - i + 1] * (n - i + 1) % mo
		return

	def fact(self, n):
		return self.fac[n]

	def invf(self, n):
		return self.inv[n]

	def comb(self, x, y):
		if y < 0 or y > x:
			return 0
		return self.fac[x] * self.inv[x - y] * self.inv[y] % mo
show_flg = False
show_flg = True
ans = 0

def solve(n, k, a):
	if k not in a:
		return 'no'
	if n == 1 and a[0] == k:
		return 'yes'
	b = [1 if i >= k else 0 for i in a]
	for i in range(n - 2):
		if sum(b[i:i + 3]) >= 2 or sum(b[i:i + 2]) == 2:
			return 'yes'
	if n >= 2 and sum(b[-2:]) == 2:
		return 'yes'
	return 'no'
T = I()
for _ in range(T):
	ans = 0
	(n, k) = LI()
	a = LI()
	a1 = solve(n, k, a)
	print(a1)


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
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())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
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
	fact(x, mod)
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa.reverse()

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 isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

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 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
		seen.add(u)
		for (v, w) in graph[u]:
			if v not in d or d[v] > d[u] + w:
				d[v] = d[u] + w
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [[ch, len(list(g))] for (ch, g) in groupby(it)]

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None

def nb(i, j):
	for (ni, nj) in [[i + 1, j], [i - 1, j], [i, j - 1], [i, j + 1]]:
		if 0 <= ni < n and 0 <= nj < m:
			yield (ni, nj)

@bootstrap
def gdfs(r, p):
	if len(g[r]) == 1 and p != -1:
		yield None
	for ch in g[r]:
		if ch != p:
			yield gdfs(ch, r)
	yield None

def lcm(a, b):
	return a * b // gcd(a, b)
t = N()
for i in range(t):
	(n, k) = RL()
	f = False
	a = RLL()
	ans = 'no'
	for i in range(n):
		if a[i] < k:
			a[i] = 0
		elif a[i] == k:
			f = True
	if f:
		if n < 2:
			ans = 'yes'
		else:
			pre = -inf
			f2 = False
			for i in range(n):
				if a[i]:
					if i - pre < 3:
						f2 = True
						break
					pre = i
			if f2:
				ans = 'yes'
	print(ans)


import collections
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	if k not in arr:
		print('No')
		continue
	elif n == 1:
		print('Yes')
		continue
	elif n == 2:
		if min(arr) == k:
			print('Yes')
			continue
		else:
			print('No')
			continue
	else:
		for i in range(n - 2):
			tmp = arr[i:i + 3]
			tmp = sorted(tmp)
			if tmp[1] >= k:
				print('Yes')
				break
		else:
			print('No')


import sys

def input():
	return sys.stdin.buffer.readline()[:-1]
for ii in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr.extend([-1, -1])
	if k not in arr:
		print('no')
	elif n == 1 and arr[0] == k:
		print('yes')
	else:
		f = 0
		for i in range(n - 1):
			if arr[i] >= k and (arr[i + 1] >= k or arr[i + 2] >= k):
				f = 1
				break
		if f:
			print('yes')
		else:
			print('no')


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip()
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def test():
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	if k not in a:
		print('no')
		return
	if n == 1 and a[0] == k:
		print('yes')
		return
	a = [a[i] >= k for i in range(n)]
	for i in range(n):
		if sum(a[i:i + 3]) >= 2:
			print('yes')
			return
	print('no')
t = int(input())
for _ in range(t):
	test()


from sys import stdin, stdout
t = int(stdin.readline())
while t != 0:
	t -= 1
	(n, k) = map(int, stdin.readline().split())
	lt = [int(x) for x in stdin.readline().split()]
	aux = [0] * n
	ans = 'NO'
	for i in range(n):
		if lt[i] == k:
			aux[i] = 1
		elif lt[i] > k:
			aux[i] = 2
	if 1 not in aux:
		ans = 'NO'
	else:
		aux = aux + [-1]
		for i in range(n - 1):
			if aux[i] > 0 and (aux[i + 1] > 0 or aux[i + 2] > 0):
				ans = 'YES'
				break
		if n == 1:
			ans = 'YES'
	stdout.write(str(ans) + '\n')


import sys
input = sys.stdin.readline

def main():
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	if min(A) == max(A) == k:
		print('yes')
		return
	if k not in A:
		print('no')
		return
	A = [x >= k for x in A] + [0, 0]
	print('yes' if max((sum(A[i:i + 3]) for i in range(n))) > 1 else 'no')
T = int(input())
for _ in range(T):
	main()