Mahmoud and Ehab are on the third stage of their adventures now. As you know, Dr. Evil likes sets. This time he won't show them any set from his large collection, but will ask them to create a new set to replenish his beautiful collection of sets.

Dr. Evil has his favorite evil integer x. He asks Mahmoud and Ehab to find a set of n distinct non-negative integers such the bitwise-xor sum of the integers in it is exactly x. Dr. Evil doesn't like big numbers, so any number in the set shouldn't be greater than 10^6.


-----Input-----

The only line contains two integers n and x (1 ≤ n ≤ 10^5, 0 ≤ x ≤ 10^5) — the number of elements in the set and the desired bitwise-xor, respectively.


-----Output-----

If there is no such set, print "NO" (without quotes).

Otherwise, on the first line print "YES" (without quotes) and on the second line print n distinct integers, denoting the elements in the set is any order. If there are multiple solutions you can print any of them.


-----Examples-----
Input
5 5

Output
YES
1 2 4 5 7
Input
3 6

Output
YES
1 2 5


-----Note-----

You can read more about the bitwise-xor operation here: https://en.wikipedia.org/wiki/Bitwise_operation#XOR

For the first sample $1 \oplus 2 \oplus 4 \oplus 5 \oplus 7 = 5$.

For the second sample $1 \oplus 2 \oplus 5 = 6$.

Source: codeforces | Difficulty: HARD
Tags: Constructive algorithms


Solutions:
(n, x) = list(map(int, input().split()))
if n == 1:
	print('YES')
	print(x)
elif n == 2 and x == 0:
	print('NO')
elif n == 2 and x != 0:
	print('YES')
	print(0, x)
else:
	print('YES')
	a = 131072
	b = 131072 * 2
	ans = 0
	for i in range(1, n - 2):
		ans = ans ^ i
		print(i, end=' ')
	if x == ans:
		print(a, b, a ^ b)
	else:
		print(ans ^ a ^ b ^ x, a, b)


def xor(a, b):
	a = bin(a)[2:]
	b = bin(b)[2:]
	while len(a) > len(b):
		b = '0' + b
	while len(b) > len(a):
		a = '0' + a
	c = ['0'] * len(a)
	for i in range(len(a)):
		if a[i] != b[i]:
			c[i] = '1'
	a = ''
	for i in c:
		a += i
	return int(a, 2)
(n, x) = input().split()
n = int(n)
x = int(x)
a = []
ans = 0
flag = False
if n % 4 != 0:
	for i in range(n - n % 4):
		a.append(100002 + i)
	if n % 4 == 1:
		a.append(x)
	elif n % 4 == 2:
		if x == 0:
			if n == 2:
				flag = True
			else:
				for i in range(4):
					del a[-1]
				a.append(500001)
				a.append(500002)
				a.append(500007)
				a.append(300046)
				a.append(210218)
				a.append(0)
		else:
			a.append(0)
			a.append(x)
	elif x == 0:
		a.append(4)
		a.append(7)
		a.append(3)
	elif x == 1:
		a.append(8)
		a.append(9)
		a.append(0)
	elif x == 2:
		a.append(1)
		a.append(4)
		a.append(7)
	else:
		a.append(0)
		a.append(1)
		if x % 2 == 0:
			a.append(x + 1)
		else:
			a.append(x - 1)
else:
	for i in range(n - 4):
		a.append(100002 + i)
	a.append(500001)
	a.append(200002)
	a.append(306275)
	a.append(x)
if flag:
	print('NO')
else:
	print('YES')
	temp = ''
	for i in a:
		temp += str(i)
		temp += ' '
	print(temp)


(n, x) = map(int, input().split())
if n == 2 and x == 0:
	print('NO')
else:
	print('YES')
	if n > 1:
		temp = x
		for i in range(n - 1):
			temp ^= i
		if temp:
			for i in range(1, n - 1):
				print(i, end=' ')
			print(2 ** 17, 2 ** 17 + temp)
		else:
			for i in range(n - 2):
				print(i, end=' ')
			print(2 ** 17, 2 ** 17 + n - 2)
	else:
		print(x)


(n, x) = tuple(map(int, input().split()))

def get_4_n_numbrs(n):
	(a, b, c, d) = (5, 10, 12, 3)
	res = []
	for i in range(n):
		pref = '1{0:014b}'.format(i)
		pref += '{0:04b}'
		res.append(pref.format(a))
		res.append(pref.format(b))
		res.append(pref.format(c))
		res.append(pref.format(d))
	return res

def get_3_nums(x):
	if x not in [1, 2]:
		x = 1 ^ 2 ^ x
		return [1, 2, x]
	else:
		x = 8 ^ 4 ^ x
		return [8, 4, x]

def get_4_nums(x):
	if x not in [1, 2, 3]:
		return [1, 2, 3, x]
	else:
		xx = 8 ^ 16 ^ 32 ^ x
		return [8, 16, 32, xx]

def get_2_nums(x):
	if x == 0:
		return [33, 3, 6, 12, 24, 48]
	else:
		return [0, x]

def get_numbers(n, x):
	if n == 1:
		return [x]
	fours = (n - 1) // 4
	res = []
	left = n - fours * 4
	if left == 2 and x == 0:
		if n == 2:
			return -1
		fours -= 1
	res.extend([int(xx, 2) for xx in get_4_n_numbrs(fours)])
	if left == 1:
		res.append(x)
	if left == 2:
		res.extend(get_2_nums(x))
	if left == 3:
		res.extend(get_3_nums(x))
	if left == 4:
		res.extend(get_4_nums(x))
	return res
res = get_numbers(n, x)
if res != -1:
	print('YES')
	print(' '.join(map(str, get_numbers(n, x))))
else:
	print('NO')


(n, x) = map(int, input().split())
if n == 1:
	print('YES')
	print(x)
elif n == 2:
	if x:
		print('YES')
		print(0, x)
	else:
		print('NO')
else:
	print('YES')
	k = 1
	for _ in ' ' * (n - 2):
		while x ^ k == 0:
			k += 1
		x = x ^ k
		print(k, end=' ')
		k += 1
	x = x ^ 458222
	print(458222, x)


def solve():
	(n, x) = [int(st) for st in input().split(' ')]
	anslist = []

	def g(x):
		if x % 2 == 0:
			return x + 1
		else:
			return x - 1
	r = 5 * 10 ** 5 + 4
	p = 2 ** 17
	if n % 4 == 1:
		anslist = [x]
		for i in range(n - 1):
			anslist.append(r + i)
	elif n % 4 == 2:
		if x == 1:
			anslist = [2, 3]
			for i in range(n - 2):
				anslist.append(r + i)
		elif x == 0:
			if n == 2:
				print('NO')
				return
			else:
				anslist = [0, 1, 3, 6, 12, 8]
				for i in range(n - 6):
					anslist.append(r + i)
		else:
			anslist = [1, g(x)]
			for i in range(n - 2):
				anslist.append(r + i)
	elif n % 4 == 3:
		if x == 1:
			anslist = [3, 5, 7]
		else:
			anslist = [p + 2, p + 3, g(x)]
		for i in range(n - 3):
			anslist.append(r + i)
	elif n % 4 == 0:
		if x == 1:
			anslist = [1, 3, 5, 6]
		else:
			anslist = [1, p + 2, p + 3, x]
		for i in range(n - 4):
			anslist.append(r + i)
	print('YES')
	for num in anslist:
		print(num, end=' ')
solve()


def main():
	(n, x) = tuple(map(int, input().split()))
	if x == 0 and n == 2:
		return ['NO']
	nn = n
	l = []
	i = 0
	e = n // 4
	if n % 4 == 0:
		e -= 1
	suka = 1 << 17
	while i < e:
		v = list(range(suka + i * 4, suka + i * 4 + 4))
		if not x in v:
			l += v
			n -= 4
		else:
			e += 1
		i += 1
	if n == 1:
		l += [x]
	if n == 2:
		if len(l) > 0:
			l[-1] ^= 777777 ^ 888888
			l += [777777, 888888 ^ x]
		else:
			l += [0, x]
	if n == 3:
		l += [777777, 888888, 777777 ^ 888888 ^ x]
	if n == 4:
		l += [777777, 888888, 777777 ^ 888888, x]
	if len(l) != nn or len(set(l)) != nn:
		return ['NO']
	return ['YES', ' '.join(map(str, l))]
print('\n'.join(main()))


(n, x) = map(int, input().split())
xs = x // 4 * 4
a = []
m = (n - 1) // 4
st = 4
for i in range(m):
	if st == xs:
		st += 4
	for j in range(4):
		a.append(st + j)
	st += 4
mm = 4 * m
if mm == n - 1:
	a.append(x)
elif mm == n - 2:
	if x == 0:
		if n == 2:
			a = []
		else:
			for i in range(4):
				a.pop()
			a.append(1 << 19 | 1 << 17)
			a.append(1 << 18 | 1 << 16)
			a.append(1 << 19)
			a.append(1 << 18)
			a.append(1 << 17)
			a.append(1 << 16)
	else:
		a.append(x)
		a.append(0)
elif mm == n - 3:
	a.append(1 << 19 | x)
	a.append(1 << 19 | 1 << 18)
	a.append(1 << 18)
else:
	a.append(1 << 19 | x)
	a.append(1 << 19 | 1 << 18)
	a.append(1 << 18 | 1 << 17)
	a.append(1 << 17)
if a:
	print('YES')
	print(*a)
else:
	print('NO')


(n, x) = map(int, input().split())
if n == 2 and x == 0:
	print('NO')
	quit()
a = 2 ** 17
b = 2 ** 18
ans = 0
print('YES')
if n == 1:
	print(x)
	quit()
if n == 2:
	print(x, 0)
	quit()
for i in range(n - 3):
	print(i + 1, end=' ')
	ans = ans ^ i + 1
if ans == x:
	print(b, a, a + b)
else:
	print(0, a, a ^ ans ^ x)


(n, x) = map(int, input().split())
if n == 2 and x == 0:
	print('NO')
	exit()
ans = []
z = n % 4
if z == 0:
	z1 = n // 4 * 4
	yo = 0
	for i in range(z1):
		ans.append(yo)
		yo += 4
	ans.pop()
	ans.pop()
	ans.pop()
	ans.pop()
	ans.append(799980)
	ans.append(399982)
	ans.append(399987)
	ans.append(ans[-1] ^ ans[-2] ^ ans[-3] ^ x)
else:
	z1 = n // 4 * 4
	yo = 0
	for i in range(z1):
		ans.append(yo)
		yo += 4
	if z == 1:
		if x in ans:
			z3 = ans.index(x, 0, len(ans))
			k = z3 // 4
			yo = 3
			for i in range(k, k + 4):
				ans[i] = yo
				yo += 4
			ans.append(x)
		else:
			ans.append(x)
	elif z == 2:
		if x % 2 == 0:
			if x != 0:
				ans.append(10 ** 5 + 1)
				ans.append(10 ** 5 + 1 ^ x)
			elif ans != []:
				ans[0] = 1
				ans[1] = 2
				ans[2] = 3
				ans[3] = 99
				ans.append(93)
				ans.append(62)
		else:
			ans.append(10 ** 5 + 6)
			ans.append(10 ** 5 + 6 ^ x)
	else:
		ans.append(799980)
		ans.append(399982)
		ans.append(ans[-1] ^ ans[-2] ^ x)
print('YES')
print(*ans)


def check(bit, x):
	n1 = '00100000000000000000'
	n2 = bin(x)[2:]
	n2 = '0' * (20 - len(n2)) + n2
	n3 = bin(bit)[2:]
	n3 = '0' * (20 - len(n3)) + n3
	n4 = ''
	for i in range(20):
		if n2[i] == '0':
			if n1[i] == '0' and n3[i] == '0' or (n1[i] == '1' and n3[i] == '1'):
				n4 = n4 + '0'
			else:
				n4 = n4 + '1'
		elif n1[i] == '0' and n3[i] == '0' or (n1[i] == '1' and n3[i] == '1'):
			n4 = n4 + '1'
		else:
			n4 = n4 + '0'
	return int(n4, 2)
(n, x) = map(int, input().split())
if n == 1:
	print('YES')
	print(x)
elif n == 2:
	if x != 0:
		print('YES')
		print(0, x)
	else:
		print('NO')
elif n == 3:
	if x == 0:
		print('YES')
		print('1 2 3')
	elif x == 1:
		print('YES')
		print('0 2 3')
	elif x % 2 == 0:
		print('YES')
		print('0 1', x + 1)
	else:
		print('YES')
		print('0 1', x - 1)
else:
	print('YES')
	bit = 0
	s = [131072]
	for i in range(1, n - 2):
		s.append(i)
		bit = bit ^ i
	for i in s:
		print(i, end=' ')
	if bit != x:
		print(0, end=' ')
		a = check(bit, x)
		print(a)
	else:
		print('262144 393216')


(n, x) = map(int, input().split())
high = 999999
arr = []
num = n - 1 - (n - 1) % 4
for i in range(num):
	arr.append(high - i)
n -= num
if n == 1:
	arr.append(x)
if n == 2 and len(arr) == 0:
	arr.append(0)
	arr.append(x)
if n == 2 and len(arr) > 2:
	arr = arr[:-4]
	arr.append(x ^ 1)
	arr.append(x ^ 2)
	arr.append(x ^ 3)
	arr.append(131072)
	arr.append(131072 + 262144)
	arr.append(262144)
if n == 3:
	arr.append(x + 131072)
	arr.append(131072 + 262144)
	arr.append(262144)
if n == 4:
	arr.append(x + 131072)
	arr.append(131072 + 262144)
	arr.append(262144 + 524288)
	arr.append(524288)
if len(arr) == 2 and x == 0:
	print('NO')
else:
	print('YES')
	print(' '.join(map(str, arr)))


(n, x) = map(int, input().split())
if n == 1:
	print('YES')
	print(x)
	exit()
elif n == 2:
	if x == 0:
		print('NO')
	else:
		print('YES')
		print(0, x)
	exit()
l = [i for i in range(1, n - 2)]
v = 0
for i in range(1, n - 2):
	v = v ^ i
r1 = x ^ v
r1 ^= 2 ** 17 + 2 ** 18
r2 = 2 ** 17 + 2 ** 19
r3 = 2 ** 18 + 2 ** 19
l.extend([r1, r2, r3])
print('YES')
print(*l)


import math
import collections
import bisect
import heapq
import time
import random
(n, x) = map(int, input().split())
if n == 1:
	print('YES')
	print(x)
elif n == 2:
	if x == 0:
		print('NO')
	else:
		print('YES')
		print(0, x)
else:
	nums = [x for x in range(1, n - 2)]
	y = 0
	for i in range(len(nums)):
		y ^= nums[i]
	if x == y:
		nums += [2 ** 17, 2 ** 18]
		nums.append(nums[-1] ^ nums[-2])
	else:
		nums += [0, 2 ** 17, 2 ** 17 ^ x ^ y]
	print('YES')
	print(' '.join([str(v) for v in nums]))


(n, x) = map(int, input().split(' '))
num = int('1111111111111111111', 2)
if n == 1:
	print('YES')
	print(x)
	exit()
if n == 2:
	if x != 0:
		print('YES')
		print(0, x)
	else:
		print('NO')
	exit()
if n == 3:
	if x == 0:
		print('YES')
		print(1, 2, 3)
	else:
		print('YES')
		print(num, num ^ x, 0)
	exit()
print('YES')
s = 1
k = 0
l = []
while len(l) != n - 3:
	if s != x:
		l.append(s)
		k ^= s
	s += 1
if k == 0:
	k ^= l[len(l) - 1]
	l[len(l) - 1] += 1
	k ^= l[len(l) - 1]
print(*l, x, num, num ^ k)


def main():
	(n, x) = map(int, input().split())
	if n == 1:
		print('YES')
		print(x)
		return
	if n == 2:
		if x == 0:
			print('NO')
		else:
			print('YES')
			print(0, x)
		return
	o = 0
	for i in range(n - 1):
		o ^= i
	print('YES')
	q = o ^ x
	if q >= n - 1:
		print(*[i for i in range(n - 1)], q)
	elif n - 2 != q:
		print(*[i for i in range(n - 2)], n - 2 + 262144, q + 262144)
	else:
		print(*[i for i in range(n - 3)], n - 3 + 262144, n - 2, q + 262144)
main()


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
(n, m) = map(int, input().split())
if n == 1:
	print('YES')
	print(m)
	sys.exit(0)
if n == 2:
	if m == 0:
		print('NO')
	else:
		print('YES')
		print(0, m)
	sys.exit(0)
s = set()
x = 0
for i in range(1, n - 2):
	s.add(i)
	x ^= i
s.add(2 ** 17)
s.add(2 ** 18)
s.add(2 ** 18 ^ 2 ** 17 ^ x ^ m)
print('YES')
print(*sorted(s))


(n, x) = map(int, input().split())
if n == 2 and x == 0:
	print('NO')
	exit()
if n == 1:
	print('YES')
	print(x)
	exit()
a = [i for i in range(1, n - 2)]
xr = 0
for i in a:
	xr ^= i
if xr == x:
	a += [2 ** 17, 2 ** 18, 2 ** 17 ^ 2 ** 18]
elif n >= 3:
	a += [0, 2 ** 17, 2 ** 17 ^ xr ^ x]
else:
	a += [2 ** 17, 2 ** 17 ^ xr ^ x]
print('YES')
print(' '.join([str(i) for i in a]))


(n, x) = input().split()
(n, x) = (int(n), int(x))
m1 = 2 ** 17
m2 = 2 ** 18
if n == 2 and x == 0:
	print('NO')
elif n == 1:
	a = [x]
elif n == 2 and x > 0:
	a = [0, x]
else:
	a = []
	ans = 0
	for i in range(1, n - 2):
		ans ^= i
		a.append(i)
	if ans == x:
		a.append(m1)
		a.append(m2)
		a.append(m1 + m2)
	else:
		a.append(m1)
		a.append(m1 ^ x ^ ans)
		a.append(0)
if not (n == 2 and x == 0):
	print('YES')
	print(' '.join([str(e) for e in a]))


(n, x) = map(int, input().split())
if n == 1:
	print('YES')
	print(x)
elif n == 2:
	if x == 0:
		print('NO')
	else:
		print('YES')
		print(0, x)
else:
	print('YES')
	res = 0
	for i in range(1, n - 2):
		print(i, end=' ')
		res ^= i
	print(1 << 18, end=' ')
	print(1 << 19, end=' ')
	print(x ^ 1 << 18 ^ 1 << 19 ^ res)


(n, x) = map(int, input().split())
if n == 1:
	print('YES')
	print(x)
elif n == 2:
	if x == 0:
		print('NO')
	else:
		print('YES')
		print(0, x)
else:
	a = 1 << 19
	c = 0
	for i in range(1, n - 2):
		c ^= i
	if c ^ n - 1 == x:
		d = n
	else:
		d = n - 1
	e = a ^ x ^ c ^ d
	print('YES')
	if n == 3:
		print(a, d, e)
	else:
		print(a, ' '.join(map(str, range(1, n - 2))), d, e)


def list_input():
	return list(map(int, input().split()))

def map_input():
	return map(int, input().split())

def map_string():
	return input().split()
from random import randint
(n, x) = map_input()
if n == 2 and x == 0:
	print('NO')
else:
	while True:
		s = set([])
		a = []
		cnt = 0
		for i in range(n - 1):
			while True:
				cur = randint(0, 500001)
				if cur not in s:
					s.add(cur)
					a.append(cur)
					cnt ^= cur
					break
		cnt ^= x
		if cnt in s:
			continue
		else:
			print('YES')
			for i in a:
				print(i, end=' ')
			print(cnt)
			break


import math
b = 200000
row = input().split(' ')
n = int(row[0])
x = int(row[1])
if n == 2 and x == 0:
	print('NO')
elif n == 1:
	print('YES\n' + str(x))
elif n == 2:
	print('YES\n' + str(x) + ' 0')
else:
	l = []
	xor = 0
	for i in range(1, n - 2):
		l.append(i)
		xor ^= i
	if xor == x:
		l.append(b)
		l.append(b * 2)
		l.append(b ^ b * 2)
	else:
		l.append(xor ^ b ^ x)
		l.append(b)
		l.append(0)
	res = ''
	for x in l:
		res += str(x) + ' '
	print('YES\n' + res)


def comp(n):
	if n % 4 == 0:
		return n
	if n % 4 == 1:
		return 1
	if n % 4 == 2:
		return n + 1
	return 0
(n, x) = map(int, input().split())
a = 1 << 17
if n == 2:
	if x == 0:
		print('NO')
	else:
		print('YES')
		print(0, x)
elif n == 1:
	print('YES')
	print(x)
else:
	ans = [i for i in range(1, n - 2)]
	if comp(n - 3) == x:
		ans.append(a * 2 ^ a)
		ans.append(a)
		ans.append(a * 2)
	else:
		ans.append(0)
		ans.append(a)
		ans.append(a ^ x ^ comp(n - 3))
	print('YES')
	print(*ans)


(n, x) = map(int, input().split())
if n == 1:
	print('Yes')
	print(x)
elif n == 2:
	if x == 0:
		print('No')
	else:
		print('Yes')
		print(0, x)
else:
	print('Yes')
	for i in range(n - 3):
		print(i, end=' ')
		x ^= i
	print(2 ** 18, 2 ** 19, x ^ 2 ** 18 ^ 2 ** 19)


def readints():
	return [int(s) for s in input().strip().split()]

def to_s(int_objs):
	return [str(obj) for obj in int_objs]

class Solver:

	def main(self):
		(n, x) = readints()
		if n == 1:
			print('Yes\n{}'.format(x))
		elif x == 0 and n == 2:
			print('No')
		elif n == 2:
			print('Yes\n{} {}'.format(0, x))
		elif n == 3:
			if x == 0:
				print('Yes\n1 2 3\n')
			else:
				print('Yes\n{} {} {}'.format((1 << 17) + x, (1 << 17) + (1 << 19), 1 << 19))
		else:
			results = [x]
			searched = 0
			current = 1
			while len(results) < n - 3:
				if current == x:
					current += 1
				results.append(current)
				searched = searched ^ current
				current += 1
			results.append((1 << 17) + searched)
			results.append((1 << 17) + (1 << 19))
			results.append(1 << 19)
			print('Yes\n' + ' '.join(to_s(results)))
Solver().main()


import sys
(n, x) = (int(x) for x in input().split())
if x == 0 and n % 4 == 2:
	if n == 2:
		print('NO')
	else:
		print('YES')
		print(1, 2, 3, 4, 8, 12, *range(200000, 200000 + (n - 6)), sep=' ')
else:
	print('YES')
	offset = 0 if x >= 8 else 3
	res = (n - 1) % 4
	for i in range(offset, offset + res):
		x ^= 1 << i
		print(1 << i, end=' ')
	print(x, *range(200000, 200000 + (n - 1 - res)), sep=' ')


from functools import reduce
(n, x) = list(map(int, input().split(' ')))
if n == 1:
	print('YES')
	print(x)
elif n == 2:
	if x == 0:
		print('NO')
	else:
		print('YES')
		print(0, x)
elif n == 3:
	print('YES')
	if x == 0:
		print(1, 2, 3)
	else:
		print(0, 1 << 17, 1 << 17 ^ x)
else:
	res = []
	if x != 0:
		res += [x]
		n -= 1
	i = 4
	while n >= 3:
		if n == 3 or n == 6:
			res += [3 << 17, 5 << 17, 6 << 17]
			n -= 3
			if n == 3:
				res += [3 << 17 ^ 1, 5 << 17 ^ 2, 6 << 17 ^ 3]
				n -= 3
		elif n == 5:
			res += [4 << 17 ^ i, 5 << 17 ^ i, 6 << 17 ^ i, 7 << 17 ^ i, 0]
			n -= 5
		else:
			res += [4 << 17 ^ i, 5 << 17 ^ i, 6 << 17 ^ i, 7 << 17 ^ i]
			n -= 4
		i += 1
	print('YES')
	print(' '.join(map(str, res)))


from functools import reduce

def solve(n, x):
	S = list(range(4 * x + 100, 4 * x + 100 + n - n % 4 - 4 * (n % 4 == 0)))
	if n % 4 == 1:
		S += [x]
	elif n % 4 == 2:
		if x:
			S += [0, x]
		elif n == 2:
			return None
		else:
			S.pop()
			S.pop()
			S.pop()
			S.pop()
			S += [1, 2, 3, 4, 8, 12]
	elif n % 4 == 3:
		S += [x ^ 1, x ^ 2, x ^ 3]
	else:
		S += [x, 1, 2, 3] if x > 3 else [x, 4, 8, 12]
	return S

def check(n, x, S):
	return len(S) == n and reduce(lambda x, y: x ^ y, S, 0) == x
(n, x) = map(int, input().split())
S = solve(n, x)
if S is None:
	print('NO')
else:
	print('YES')
	print(' '.join(map(str, S)))


tmp = list(map(int, input().split(' ')))
(n, x) = (tmp[0], tmp[1])
pw = 2 ** 17
if n == 2 and x == 0:
	print('NO')
else:
	print('YES')
	if n == 1:
		print(x)
	elif n == 2:
		print(0, x)
	else:
		y = 0
		for i in range(1, n - 2):
			print(i, end=' ')
			y = y ^ i
		if x == y:
			print(pw, 2 * pw, pw ^ 2 * pw)
		else:
			print(0, pw, pw ^ x ^ y)


(n, x) = map(int, input().split())
ans = []
xor = 0
if n == 1:
	print('YES')
	print(x)
	exit()
if n == 2 and x == 0:
	print('NO')
	exit()
for i in range(1, n + 1):
	ans.append(i)
	xor ^= i
to_add = xor ^ x
if to_add != 0:
	if to_add == 3:
		if n >= 3:
			ans[2] = 0
	else:
		ans[0] ^= 262144
		ans[1] ^= 262144 ^ to_add
if len(ans) == n:
	print('YES')
	print(' '.join((str(i) for i in ans)))
else:
	print('NO')


(n, x) = [int(i) for i in input().split()]
a = 0
if (n - 1) % 2 == 0:
	for i in range(10 ** 6, 10 ** 6 - n + 1, -1):
		a = a ^ i
	for i in range(10 ** 6 - n):
		if a ^ i == x:
			print('YES')
			for j in range(10 ** 6, 10 ** 6 - n + 1, -1):
				print(j, end=' ')
			print(i)
			exit()
	print('NO')
else:
	if n == 2 and x == 0:
		print('NO')
		exit()
	if n == 2:
		print('YES')
		if x != 0:
			print(0, x)
		exit()
	for i in range(10 ** 6, 10 ** 6 - n + 3, -1):
		a = a ^ i
	tm = 10 ** 6 - n + 3
	if x == a ^ tm:
		a = a ^ tm - 1 ^ 1
		for i in range(10 ** 6 - n):
			if i != 1:
				if a ^ i == x:
					print('YES')
					for j in range(10 ** 6, 10 ** 6 - n + 3, -1):
						print(j, end=' ')
					print(1, end=' ')
					print(tm - 1, end=' ')
					print(i)
					exit()
	a = a ^ tm
	a = a ^ 1
	for i in range(10 ** 6 - n):
		if i != 1:
			if a ^ i == x:
				print('YES')
				for j in range(10 ** 6, 10 ** 6 - n + 2, -1):
					print(j, end=' ')
				print(1, end=' ')
				print(i)
				exit()
	print('NO')


(n, m) = map(int, input().split())
if n == 2 and m == 0:
	print('NO')
	exit()
print('YES')
if n == 1:
	print(m)
	exit()
if n == 2 and m:
	print(0, m)
	exit()
pw = 10 ** 6 // 2 - 2
l = [i for i in range(1, n - 3 + 1)]
y = 0
for i in l:
	y ^= i
if m == y:
	print(*l, pw, pw * 2, pw ^ pw * 2)
else:
	print(*l, pw, pw ^ m ^ y, 0)


from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue, PriorityQueue
from heapq import *
from statistics import *
from math import *
import fractions
import copy
from copy import deepcopy
import sys
import io
sys.setrecursionlimit(10000)
import math
import os
import bisect
import collections
mod = pow(10, 9) + 7
import random
from random import *
from time import time

def ncr(n, r, p=mod):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def normalncr(n, r):
	r = min(r, n - r)
	count = 1
	for i in range(n - r, n + 1):
		count *= i
	for i in range(1, r + 1):
		count //= i
	return count
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

def reverse_bisect_right(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x > a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def reverse_bisect_left(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x >= a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def get_list():
	return list(map(int, input().split()))

def get_str_list_in_int():
	return [int(i) for i in list(input())]

def get_str_list():
	return list(input())

def get_map():
	return map(int, input().split())

def input_int():
	return int(input())

def matrix(a, b):
	return [[0 for i in range(b)] for j in range(a)]

def swap(a, b):
	return (b, a)

def find_gcd(l):
	a = l[0]
	for i in range(len(l)):
		a = gcd(a, l[i])
	return a

def is_prime(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return 0
	return 1

def prime_factors(n):
	while n % 2 == 0:
		return [2] + prime_factors(n // 2)
	sqrta = int(sqrt(n))
	for i in range(3, sqrta + 1, 2):
		if n % i == 0:
			return [i] + prime_factors(n // i)
	return [n]

def p(a):
	if type(a) == str:
		print(a + '\n')
	else:
		print(str(a) + '\n')

def ps(a):
	if type(a) == str:
		print(a)
	else:
		print(str(a))

def kth_no_not_div_by_n(n, k):
	return k + (k - 1) // (n - 1)

def forward_array(l):
	n = len(l)
	stack = []
	forward = [0] * n
	for i in range(len(l) - 1, -1, -1):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			forward[i] = len(l)
		else:
			forward[i] = stack[-1]
		stack.append(i)
	return forward

def backward_array(l):
	n = len(l)
	stack = []
	backward = [0] * n
	for i in range(len(l)):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			backward[i] = -1
		else:
			backward[i] = stack[-1]
		stack.append(i)
	return backward
nc = 'NO'
yc = 'YES'
ns = 'No'
ys = 'Yes'

def rem_list(rem):
	l = []
	for i in range(10 ** 6 - 1, 10 ** 6 - rem - 1, -1):
		l.append(i)
	return l

def lista(n, x, rem):
	if x == 0:
		if n % 4 == 2:
			rem -= 4
			l = rem_list(rem)
			m = [x + 2 ** 17, 2 ** 17 + 1, 2 ** 17 + 2, 2 ** 17 + 4, 2 ** 17 + 8, 2 ** 17 + 15]
			print(*l + m)
			return None
	if n == 1:
		return [x]
	elif n == 2:
		return [x + 2 ** 17, 2 ** 17]
	elif n == 3:
		return [x + 2 ** 17, 2 ** 18, 2 ** 17 + 2 ** 18]
	elif n == 4:
		return [x, 2 ** 17, 2 ** 18, 2 ** 17 + 2 ** 18]

def xor(a):
	xora = 0
	for i in a:
		xora ^= i
	print(xora)
t = 1
for i in range(t):
	(n, x) = get_list()
	if x == 0:
		if n == 2:
			print(nc)
			continue
	rem = n // 4
	n -= rem * 4
	if n == 0:
		n = 4
		rem -= 1
	rem *= 4
	print(yc)
	l = rem_list(rem)
	m = lista(n, x, rem)
	if m != None:
		print(*l + m)


import sys
(n, x) = map(int, input().split())
pw1 = 1 << 17
pw2 = 1 << 18
if n == 1:
	print('YES\n', x)
elif n == 2 and x == 0:
	print('NO')
elif n == 2:
	print('YES\n0', x)
else:
	ans = 0
	print('YES')
	for i in range(1, n - 2):
		sys.stdout.write(str(i) + ' ')
		ans ^= i
	if ans == x:
		print(pw1 + pw2, pw1, pw2)
	else:
		print(pw1, pw1 ^ x ^ ans, '0')


(n, x) = list(map(int, input().split()))
xor = x
if n == 1:
	print('YES')
	print(x)
elif n == 2:
	if x == 0:
		print('NO')
	else:
		print('YES')
		print(0, x)
else:
	print('YES')
	k = 1
	for u in range(n - 2):
		while xor ^ k == 0:
			k += 1
		xor = xor ^ k
		print(k, end=' ')
		k += 1
	xor = xor ^ 524287
	print(524287, end=' ')
	print(xor)


(n, x) = map(int, input().split())
s = 1 << 17
if x:
	t = [x] if n & 1 else [x, 0]
	n = (n - len(t)) // 2
	if n & 1:
		t[0] += s
elif n & 1:
	n = (n - 1) // 2
	t = [s] if n & 1 else [0]
else:
	n = n // 2
	t = [s, 2 * s, 4 * s, 6 * s] if n & 1 else []
	n -= len(t) // 2
if n < 0:
	y = 'NO'
else:
	n += 1
	p = list(range(n))
	if x < n:
		p[x] = n
	p.pop(0)
	p += [q + s for q in p]
	y = 'YES\n' + ' '.join(map(str, t + p))
print(y)


import os
import sys
import math
from io import BytesIO, IOBase
import io
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
from collections import Counter
import threading
BUFSIZE = 8192

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(10001)]
prime[0] = prime[1] = False

def SieveOfEratosthenes(n=10000):
	p = 2
	c = 0
	while p <= n:
		if prime[p] == True:
			c += 1
			for i in range(p, n + 1, p):
				prime[i] = False
		p += 1

class DSU:

	def __init__(self, R, C):
		self.par = range(R * C + 1)
		self.rnk = [0] * (R * C + 1)
		self.sz = [1] * (R * C + 1)

	def find(self, x):
		if self.par[x] != x:
			self.par[x] = self.find(self.par[x])
		return self.par[x]

	def union(self, x, y):
		(xr, yr) = (self.find(x), self.find(y))
		if xr == yr:
			return
		if self.rnk[xr] < self.rnk[yr]:
			(xr, yr) = (yr, xr)
		if self.rnk[xr] == self.rnk[yr]:
			self.rnk[xr] += 1
		self.par[yr] = xr
		self.sz[xr] += self.sz[yr]

	def size(self, x):
		return self.sz[self.find(x)]

	def top(self):
		return self.size(len(self.sz) - 1) - 1

class LazySegTree:

	def __init__(self, _op, _e, _mapping, _composition, _id, v):

		def set(p, x):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			_d[p] = x
			for i in range(1, _log + 1):
				_update(p >> i)

		def get(p):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			return _d[p]

		def prod(l, r):
			assert 0 <= l <= r <= _n
			if l == r:
				return _e
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r >> i)
			sml = _e
			smr = _e
			while l < r:
				if l & 1:
					sml = _op(sml, _d[l])
					l += 1
				if r & 1:
					r -= 1
					smr = _op(_d[r], smr)
				l >>= 1
				r >>= 1
			return _op(sml, smr)

		def apply(l, r, f):
			assert 0 <= l <= r <= _n
			if l == r:
				return
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r - 1 >> i)
			l2 = l
			r2 = r
			while l < r:
				if l & 1:
					_all_apply(l, f)
					l += 1
				if r & 1:
					r -= 1
					_all_apply(r, f)
				l >>= 1
				r >>= 1
			l = l2
			r = r2
			for i in range(1, _log + 1):
				if l >> i << i != l:
					_update(l >> i)
				if r >> i << i != r:
					_update(r - 1 >> i)

		def _update(k):
			_d[k] = _op(_d[2 * k], _d[2 * k + 1])

		def _all_apply(k, f):
			_d[k] = _mapping(f, _d[k])
			if k < _size:
				_lz[k] = _composition(f, _lz[k])

		def _push(k):
			_all_apply(2 * k, _lz[k])
			_all_apply(2 * k + 1, _lz[k])
			_lz[k] = _id
		_n = len(v)
		_log = _n.bit_length()
		_size = 1 << _log
		_d = [_e] * (2 * _size)
		_lz = [_id] * _size
		for i in range(_n):
			_d[_size + i] = v[i]
		for i in range(_size - 1, 0, -1):
			_update(i)
		self.set = set
		self.get = get
		self.prod = prod
		self.apply = apply
MIL = 1 << 20

def makeNode(total, count):
	return total * MIL + count

def getTotal(node):
	return math.floor(node / MIL)

def getCount(node):
	return node - getTotal(node) * MIL
nodeIdentity = makeNode(0.0, 0.0)

def nodeOp(node1, node2):
	return node1 + node2
	return makeNode(getTotal(node1) + getTotal(node2), getCount(node1) + getCount(node2))
identityMapping = -1

def mapping(tag, node):
	if tag == identityMapping:
		return node
	count = getCount(node)
	return makeNode(tag * count, count)

def composition(mapping1, mapping2):
	return mapping1 if mapping1 != identityMapping else mapping2

def memodict(f):

	class memodict(dict):

		def __missing__(self, key):
			ret = self[key] = f(key)
			return ret
	return memodict().__getitem__

def pollard_rho(n):
	if n & 1 == 0:
		return 2
	if n % 3 == 0:
		return 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			prev = p
			p = p * p % n
			if p == 1:
				return math.gcd(prev - 1, n)
			if p == n - 1:
				break
		else:
			for i in range(2, n):
				(x, y) = (i, (i * i + 1) % n)
				f = math.gcd(abs(x - y), n)
				while f == 1:
					(x, y) = ((x * x + 1) % n, (y * y + 1) % n)
					y = (y * y + 1) % n
					f = math.gcd(abs(x - y), n)
				if f != n:
					return f
	return n

@memodict
def prime_factors(n):
	if n <= 1:
		return Counter()
	f = pollard_rho(n)
	return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f)

def distinct_factors(n):
	factors = [1]
	for (p, exp) in prime_factors(n).items():
		factors += [p ** i * factor for factor in factors for i in range(1, exp + 1)]
	return factors

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small

def binarySearch(arr, n, i, key):
	left = 0
	right = n - 1
	mid = 0
	res = n
	while left <= right:
		mid = (right + left) // 2
		if arr[mid][i] > key:
			res = mid
			right = mid - 1
		else:
			left = mid + 1
	return res

def binarySearch1(arr, n, i, key):
	left = 0
	right = n - 1
	mid = 0
	res = -1
	while left <= right:
		mid = (right + left) // 2
		if arr[mid][i] > key:
			right = mid - 1
		else:
			res = mid
			left = mid + 1
	return res
import os
import sys
import math
from io import BytesIO, IOBase
import io
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
from collections import Counter
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(10001)]
prime[0] = prime[1] = False

def SieveOfEratosthenes(n=10000):
	p = 2
	c = 0
	while p <= n:
		if prime[p] == True:
			c += 1
			for i in range(p, n + 1, p):
				prime[i] = False
		p += 1

class DSU:

	def __init__(self, R, C):
		self.par = range(R * C + 1)
		self.rnk = [0] * (R * C + 1)
		self.sz = [1] * (R * C + 1)

	def find(self, x):
		if self.par[x] != x:
			self.par[x] = self.find(self.par[x])
		return self.par[x]

	def union(self, x, y):
		(xr, yr) = (self.find(x), self.find(y))
		if xr == yr:
			return
		if self.rnk[xr] < self.rnk[yr]:
			(xr, yr) = (yr, xr)
		if self.rnk[xr] == self.rnk[yr]:
			self.rnk[xr] += 1
		self.par[yr] = xr
		self.sz[xr] += self.sz[yr]

	def size(self, x):
		return self.sz[self.find(x)]

	def top(self):
		return self.size(len(self.sz) - 1) - 1

class LazySegTree:

	def __init__(self, _op, _e, _mapping, _composition, _id, v):

		def set(p, x):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			_d[p] = x
			for i in range(1, _log + 1):
				_update(p >> i)

		def get(p):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			return _d[p]

		def prod(l, r):
			assert 0 <= l <= r <= _n
			if l == r:
				return _e
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r >> i)
			sml = _e
			smr = _e
			while l < r:
				if l & 1:
					sml = _op(sml, _d[l])
					l += 1
				if r & 1:
					r -= 1
					smr = _op(_d[r], smr)
				l >>= 1
				r >>= 1
			return _op(sml, smr)

		def apply(l, r, f):
			assert 0 <= l <= r <= _n
			if l == r:
				return
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r - 1 >> i)
			l2 = l
			r2 = r
			while l < r:
				if l & 1:
					_all_apply(l, f)
					l += 1
				if r & 1:
					r -= 1
					_all_apply(r, f)
				l >>= 1
				r >>= 1
			l = l2
			r = r2
			for i in range(1, _log + 1):
				if l >> i << i != l:
					_update(l >> i)
				if r >> i << i != r:
					_update(r - 1 >> i)

		def _update(k):
			_d[k] = _op(_d[2 * k], _d[2 * k + 1])

		def _all_apply(k, f):
			_d[k] = _mapping(f, _d[k])
			if k < _size:
				_lz[k] = _composition(f, _lz[k])

		def _push(k):
			_all_apply(2 * k, _lz[k])
			_all_apply(2 * k + 1, _lz[k])
			_lz[k] = _id
		_n = len(v)
		_log = _n.bit_length()
		_size = 1 << _log
		_d = [_e] * (2 * _size)
		_lz = [_id] * _size
		for i in range(_n):
			_d[_size + i] = v[i]
		for i in range(_size - 1, 0, -1):
			_update(i)
		self.set = set
		self.get = get
		self.prod = prod
		self.apply = apply
MIL = 1 << 20

def makeNode(total, count):
	return total * MIL + count

def getTotal(node):
	return math.floor(node / MIL)

def getCount(node):
	return node - getTotal(node) * MIL
nodeIdentity = makeNode(0.0, 0.0)

def nodeOp(node1, node2):
	return node1 + node2
	return makeNode(getTotal(node1) + getTotal(node2), getCount(node1) + getCount(node2))
identityMapping = -1

def mapping(tag, node):
	if tag == identityMapping:
		return node
	count = getCount(node)
	return makeNode(tag * count, count)

def composition(mapping1, mapping2):
	return mapping1 if mapping1 != identityMapping else mapping2

def memodict(f):

	class memodict(dict):

		def __missing__(self, key):
			ret = self[key] = f(key)
			return ret
	return memodict().__getitem__

def pollard_rho(n):
	if n & 1 == 0:
		return 2
	if n % 3 == 0:
		return 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			prev = p
			p = p * p % n
			if p == 1:
				return math.gcd(prev - 1, n)
			if p == n - 1:
				break
		else:
			for i in range(2, n):
				(x, y) = (i, (i * i + 1) % n)
				f = math.gcd(abs(x - y), n)
				while f == 1:
					(x, y) = ((x * x + 1) % n, (y * y + 1) % n)
					y = (y * y + 1) % n
					f = math.gcd(abs(x - y), n)
				if f != n:
					return f
	return n

@memodict
def prime_factors(n):
	if n <= 1:
		return Counter()
	f = pollard_rho(n)
	return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f)

def distinct_factors(n):
	factors = [1]
	for (p, exp) in prime_factors(n).items():
		factors += [p ** i * factor for factor in factors for i in range(1, exp + 1)]
	return factors

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small

def binarySearch(arr, n, i, key):
	left = 0
	right = n - 1
	mid = 0
	res = n
	while left <= right:
		mid = (right + left) // 2
		if arr[mid][i] > key:
			res = mid
			right = mid - 1
		else:
			left = mid + 1
	return res

def binarySearch1(arr, n, i, key):
	left = 0
	right = n - 1
	mid = 0
	res = -1
	while left <= right:
		mid = (right + left) // 2
		if arr[mid][i] > key:
			right = mid - 1
		else:
			res = mid
			left = mid + 1
	return res
t = 1
for _ in range(t):
	(n, x) = map(int, input().split())
	if n == 2 and x == 0:
		print('NO')
		continue
	if n % 2:
		a = []
		xor = 0
		for i in range(n - 1):
			xor = xor ^ i + 262144
			a.append(i + 262144)
		a.append(xor ^ x)
	else:
		a = [0]
		xor = 0
		for i in range(n - 2):
			xor = xor ^ i + 262144
			a.append(i + 262144)
		if xor ^ x == 0:
			xor ^= a[-1]
			a[-1] += 1
			xor ^= a[-1]
		a.append(xor ^ x)
	print('YES')
	print(*a)


import sys
import functools
(N, Y) = (int(i) for i in sys.stdin.readline().strip().split(' '))
if N == 1:
	print('YES')
	print(Y)
elif N == 2:
	if Y == 0:
		print('NO')
	else:
		print('YES')
		print('{} {}'.format(0, Y))
else:
	S = list(range(1, N - 2))
	P = functools.reduce(lambda x, y: x ^ y, S, N - 2)
	if P ^ Y == 0:
		P = functools.reduce(lambda x, y: x ^ y, S, N - 1)
		S.append(N - 1)
	else:
		S.append(N - 2)
	x_1 = 2 ** 17
	x_2 = P ^ Y ^ x_1
	print('YES')
	print('{} {} {}'.format(' '.join((str(s) for s in S)), x_1, x_2))


(n, x) = map(int, input().split())
if n == 1:
	print('YES')
	print(x)
elif n == 2:
	if x:
		print('YES\n0', x)
	else:
		print('NO')
else:
	print('YES')
	y = 0
	p = 1 << 17
	for i in range(1, n - 2):
		print(i, end=' ')
		y ^= i
	if y - x:
		print(0, p, p ^ x ^ y)
	else:
		print(p, p * 2, p ^ p * 2)


from sys import stdin, stdout

class Solve:

	def __init__(self):
		R = stdin.readline
		W = stdout.write
		(n, x) = map(int, R().split())
		ans = []
		if n == 2 and x == 0:
			W('NO\n')
			return
		elif n == 1:
			W('YES\n%d' % x)
			return
		elif n == 2:
			W('YES\n%d %d' % (0, x))
			return
		ans = ['YES\n']
		xor = 0
		for i in range(1, n - 2):
			xor ^= i
			ans.append(str(i) + ' ')
		if xor == x:
			ans += [str(2 ** 17) + ' ', str(2 ** 18) + ' ', str(2 ** 17 ^ 2 ** 18)]
		else:
			ans += ['0 ', str(2 ** 17) + ' ', str(2 ** 17 ^ xor ^ x)]
		W(''.join(ans))

def main():
	s = Solve()
main()


import random
import sys
(n, k) = input().split()
n = int(n)
k = int(k)
for tries in range(10000):
	a = random.sample(range(100001), n - 1)
	x = 0
	for i in a:
		x ^= i
	if k ^ x not in a:
		print('YES')
		for i in a:
			print(i)
		print(k ^ x)
		sys.exit()
print('NO')


from functools import *
(n, x) = map(int, input().split())
if n == 1:
	t = [x]
elif n == 2:
	t = [0, x] if x else []
else:
	s = 1 << 17
	t = list(range(1, n - 2))
	p = reduce(lambda x, y: x ^ y, t) if t else 0
	if p - x:
		t += [0, s, s ^ x ^ p]
	else:
		t += [s, s * 2, s ^ s * 2]
t = ' '.join(map(str, t))
print(['YES\n', 'NO'][t == ''] + t)


(n, x) = map(int, input().split())
num = 1 << 17
val = 0
if n == 1:
	print('YES\n%d' % x)
elif n == 2:
	print('NO' if x == 0 else 'YES\n0 %d' % x)
else:
	print('YES')
	for i in range(1, n - 2):
		print(i, end=' ')
		val ^= i
	if x != val:
		print(num ^ x, num ^ val, 0)
	else:
		print(num, num << 1, num ^ num << 1)


(nums, req) = input().split()
(nums, req) = (int(nums), int(req))
numbers = list(range(0, nums - 1))
xor = 0
for num in numbers:
	xor ^= num
needed = req ^ xor
if needed > nums - 2:
	numbers.append(needed)
elif numbers[-1] != needed:
	numbers[-1] += 2 ** 18
	numbers.append(2 ** 18 + needed)
else:
	numbers[0] += 2 ** 18
	numbers.append(2 ** 18 + needed)
if nums == 2 and req == 0:
	print('NO')
else:
	print('YES')
	print(' '.join(list(map(str, numbers))))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	(n, k) = [int(x) for x in input().split()]
	if (n, k) == (2, 0):
		print('NO')
	elif n == 1:
		print('YES')
		print(k)
	else:
		ans = [i for i in range(1, n - 1)]
		tg = k ^ [n - 2, 1, n - 1, 0][n - 2 & 3]
		if not tg:
			tg ^= ans[-1]
			ans[-1] = 0
		ans.append(524288)
		ans.append(524288 ^ tg)
		print('YES')
		print(*ans)
main()