

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int t,n,k,x;
    	cin >> t;
    	while ( t-- ) {
    		cin >> k >> n;
    		int ans = k;
    		for ( int i = 0; i < n; i++ ) {
    			cin >> x;
    			ans = (ans & x);
    		}
    		if ( ans == 0 ) cout << "Yes" << endl;
    		else cout << "No" << endl;
    	}
        return 0;
    }

