T=int(raw_input())
while T>0:
	line2=raw_input()
	line2s=line2.split()
	N=int(line2s[0])
	P=int(line2s[1])
	line3=raw_input()
	powers=line3.split()
	for i in range(0,len(powers)):
		powers[i]=int(powers[i])
	powers.sort()
	try:
		D=powers.index(P)
		print "YES",
		print len(powers)-D-1
	except ValueError:
		print "NO",
		print 0
		
	T-=1