#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 50;
int n , x;
vector < int > rx;
bool Solve(){
random_shuffle( rx.begin() , rx.end() );
int w = 0;
for(int i = 0 ; i < n - 1 ; ++ i) w ^= rx[i];
int an = x ^ w;
for(int i = 0 ; i < n - 1 ; ++ i)
if( an == rx[i] )
return false;
if( an > 1e6 ) return false;
return true;
}
int main( int argc , char * argv[] ){
//freopen( "Sample" , "r" , stdin );
srand( time( NULL ) );
for(int i = 0 ; i <= 1000000 ; ++ i) rx.emplace_back( i );
cin >> n >> x;
if( n == 2 && x == 0 ){
puts( "NO" );
return 0;
}
printf( "YES\n" );
if( n == 1 ) printf( "%d\n" , x );
else{
while( !Solve( ) );
int w = x;
for(int i = 0 ; i < n - 1 ; ++ i) printf( "%d " , rx[i] ) , w ^= rx[i];
printf( "%d\n" , w );
}
return 0;
}
CiAjaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBpbnQgbWF4biA9IDFlNSArIDUwOwoKaW50IG4gLCB4Owp2ZWN0b3IgPCBpbnQgPiByeDsKCmJvb2wgU29sdmUoKXsKCXJhbmRvbV9zaHVmZmxlKCByeC5iZWdpbigpICwgcnguZW5kKCkgKTsKCWludCB3ID0gMDsKCWZvcihpbnQgaSA9IDAgOyBpIDwgbiAtIDEgOyArKyBpKSB3IF49IHJ4W2ldOwoJaW50IGFuID0geCBeIHc7Cglmb3IoaW50IGkgPSAwIDsgaSA8IG4gLSAxIDsgKysgaSkKCQlpZiggYW4gPT0gcnhbaV0gKQoJCQlyZXR1cm4gZmFsc2U7CglpZiggYW4gPiAxZTYgKSByZXR1cm4gZmFsc2U7CglyZXR1cm4gdHJ1ZTsKfQoKaW50IG1haW4oIGludCBhcmdjICwgY2hhciAqIGFyZ3ZbXSApewoJLy9mcmVvcGVuKCAiU2FtcGxlIiAsICJyIiAsIHN0ZGluICk7CglzcmFuZCggdGltZSggTlVMTCApICk7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