Help me in solving CS2023_PON problem

My issue

Can any one point out the flaw in my logic, as it seems to be working on paper, but is failing all the test cases except one.

My code

# cook your dish here
nums = dict() 
for i in range(31):
    nums[(2**i-1)] = 0

def solution(arr,b):
    nums2 = [] #arr that contains all the numbers that will return B when bitwise AND operation is done with B and that number.
        
    for num in arr:
        if num&b == b:
            nums2.append(num)    

# now I am taking all the numbers that return B upon bitwise AND with B and finding if any number in the entire array returns B when performed bitwise AND with this number.
    for num in nums2:
        for posAns in arr:
            if posAns&num==b:
                return "YES"
    return "NO"

for _ in range(int(input())):
    n,b = map(int,input().split())
    arr = list(map(int,input().split()))
    
    print(solution(arr,b))

Problem Link: CS2023_PON Problem - CodeChef

I think your solution has problems when the solution is a subsequence with 3 or more elements. A custom test case that you might want to try is

3 1
7 11 13

The expected result is “yes” because 7 & 11 & 13 == 1.