#include <cstddef>
#include <cstdint>
#include <ios>
#include <iostream>

using ll = int64_t;

int main(){
    std::ios::sync_with_stdio(false),std::cin.tie(nullptr),std::cout.tie(nullptr);
    ll t;
    std::cin>>t;
    while(t--){
        static ll n,m;
        std::cin>>n>>m;
        const ll maxn{size_t(5e5+5)};
        static ll a[maxn];
        for(ll i{1};i<=n;i++){
            std::cin>>a[i];
        }
        for(ll i{1};i<=n;i++){
            ll msk{a[i]};
            for(ll j{i};j<=n;j++){
                msk&=a[j];
                if(msk==m){
                    std::cout<<"Yes\n";
                    goto outLoop;
                }
            }
        }
        std::cout<<"No\n";
        outLoop:;
    }    
}