'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name

print 'Hello World!'
'''
t=int(input())
for j in range(t):
	n,p=raw_input().split()
	p=int(p)
	n=[int(i) for i in raw_input().split()]
	if p in n:
		n.sort()
		ind=n.index(p)
		l=len(n[ind+1:])
		print("YES %d"%l)		
	else:
		print("NO 0")