def game():
    for test in range(input()):
        num, spower = map(int, raw_input().split())
        mylist = map(int, raw_input().split())
        mylist.sort()
        reqindex = 0
        flag = 0
        for index in range(num):
            val = mylist[index]
            if val < spower:
                reqindex = index
            elif val == spower:
                reqindex = index
                flag = 1
                break
            else:
                break
        if flag == 1:
            print "YES",
            print num - 1 - reqindex
        else:
            print "NO",
            print 0

game()