Given 2 integers $u$ and $v$, find the shortest array such that bitwise-xor of its elements is $u$, and the sum of its elements is $v$.


-----Input-----

The only line contains 2 integers $u$ and $v$ $(0 \le u,v \le 10^{18})$.


-----Output-----

If there's no array that satisfies the condition, print "-1". Otherwise:

The first line should contain one integer, $n$, representing the length of the desired array. The next line should contain $n$ positive integers, the array itself. If there are multiple possible answers, print any.


-----Examples-----
Input
2 4

Output
2
3 1
Input
1 3

Output
3
1 1 1
Input
8 5

Output
-1
Input
0 0

Output
0


-----Note-----

In the first sample, $3\oplus 1 = 2$ and $3 + 1 = 4$. There is no valid array of smaller length.

Notice that in the fourth sample the array is empty.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Number theory

Bit manipulation

Constructive algorithms

Greedy algorithms


Solutions:
(u, v) = [int(x) for x in input().split()]
v1 = (v - u) // 2
v2 = (v + u) // 2
if u > v or (v - u) % 2 == 1:
	print(-1)
elif u == v and v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
elif v1 ^ v2 == u:
	print(2)
	print(v1, v2)
else:
	print(3)
	print(v1, v1, u)


import sys
import math

def alele():
	return list(map(int, sys.stdin.readline().strip().split()))

def ilele():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
import bisect
from collections import defaultdict
INF = 10 ** 18
MOD = 10 ** 9 + 7
(u, v) = ilele()
if v < u:
	print(-1)
elif v == u == 0:
	print(0)
elif v == u:
	print(1)
	print(u)
elif v % 2 != u % 2:
	print(-1)
else:
	y = (v - u) // 2
	a = u + y
	b = y
	if a + b == v and a ^ b == u:
		print(2)
		print(u + y, y)
	else:
		print(3)
		print(u, y, y)


import sys
(u, v) = [int(v) for v in sys.stdin.readline().split()]

def m():
	if (v - u) % 2 == 1:
		return None
	ar = []
	h = (v - u) // 2
	if u & h == 0:
		ar.append(u | h)
		ar.append(h)
	else:
		ar.append(u)
		ar.append(h)
		ar.append(h)
	return ar
if u > v:
	print(-1)
elif u == v:
	if u == 0:
		print(0)
	else:
		print(1)
		print(u)
else:
	ar = m()
	if ar is not None:
		print(len(ar))
		print(' '.join(map(str, ar)))
	else:
		print(-1)


def two(s, x):
	aa = (s - x) // 2
	a = 0
	b = 0
	for i in range(0, 100):
		nowi = x & 1 << i
		nowa = aa & 1 << i
		if nowi == 0 and nowa == 0:
			continue
		if nowi == 0 and nowa > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif nowi > 0 and nowa == 0:
			a = 1 << i | a
		else:
			return (0, 0)
	return (a, b)

def main():
	(u, v) = [int(i) for i in input().split()]
	if (v - u) % 2 != 0:
		print(-1)
		return 0
	if u == v:
		if u == 0:
			print(0)
			return 0
		else:
			print(1, v)
			return 0
	if u > v:
		print(-1)
		return 0
	if two(v, u) != (0, 0):
		print(2)
		print(two(v, u)[0], two(v, u)[1])
		return 0
	if (v - u) % 2 != 0:
		print(-1)
		return 0
	print(3)
	print((v - u) // 2, (v - u) // 2, u)
main()


import atexit
import io
import sys
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())

def main():
	(u, v) = map(int, input().split())
	if u > v:
		print(-1)
	elif u == v:
		if u:
			print(1, u, sep='\n')
		else:
			print(u)
	elif v - u & 1:
		print(-1)
	elif u + (v - u) // 2 == u ^ (v - u) // 2:
		print(2)
		print((v - u) // 2, u + (v - u) // 2)
	else:
		print(3)
		print(u, (v - u) // 2, (v - u) // 2)
main()


(u, v) = map(int, input().split())
if u > v or u & 1 != v & 1:
	print(-1)
elif v == u and u == 0:
	print(0)
elif v == u:
	print(1)
	print(u)
else:
	r = (v - u) // 2
	if r & u:
		print(3)
		print(u, r, r)
	else:
		print(2)
		print(u ^ r, r)


def main():
	(u, v) = map(int, input().split())
	if v < u or v % 2 != u % 2:
		print(-1)
	elif v == u:
		if u != 0:
			print(1)
			print(u)
		else:
			print(0)
	else:
		x = (v - u) // 2
		if not u & x:
			print(2)
			print(u + x, x)
		else:
			print(3)
			print(u, x, x)
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
threading.stack_size(10 ** 8)
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(300000)
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=2 ** 51, 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 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

def compute(S, X):
	A = (S - X) // 2
	a = 0
	b = 0
	for i in range(64):
		Xi = X & 1 << i
		Ai = A & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			return [-1, -1]
	return [a, b]
(a, b) = map(int, input().split())
if b < a:
	print(-1)
elif a == b == 0:
	print(0)
elif a == b:
	print(1)
	print(a)
else:
	(x, y) = compute(b, a)
	if x != -1 and x + y == b and (x ^ y == a):
		print(2)
		print(x, y)
	else:
		c = b - a
		if c % 2 == 0:
			print(3)
			print(c // 2, c // 2, a)
		else:
			print(-1)


(u, v) = [int(i) for i in input().split(' ')]
if v == 0:
	print(0)
elif v == u:
	print(1)
	print(v)
elif v > u and (v - u) % 2 == 0:
	if u ^ (v - u) // 2 == u + (v - u) // 2:
		print(2)
		print(u + (v - u) // 2, (v - u) // 2)
	else:
		print(3)
		print(u, (v - u) // 2, (v - u) // 2)
else:
	print(-1)


(u, v) = input().split()
u = int(u)
v = int(v)
delta = v - u
if delta < 0 or delta % 2 == 1:
	print(-1)
elif delta == 0:
	if u == 0:
		print('0')
	else:
		print('1', '\n', u, sep='')
else:
	d2 = delta // 2
	if d2 & u:
		print('3', '\n', d2, ' ', d2, ' ', u, sep='')
	else:
		print('2\n', d2, ' ', d2 ^ u, sep='')


from sys import stdin
inf = stdin
(v, u) = map(int, inf.readline().split(' '))
if u > v:
	if v % 2 != u % 2:
		print(-1)
	else:
		posi = v
		temp = (u - v) // 2
		if posi + temp == posi ^ temp:
			print(2)
			print(posi + temp, temp)
		else:
			print(3)
			print(temp, temp, posi)
elif u == v:
	if u != 0:
		print(1)
	print(u)
else:
	print(-1)


(u, v) = map(int, input().split())
if u & 1 ^ v & 1 or u > v:
	print(-1)
	exit()
if not u and (not v):
	print(0)
	exit()
if u == v:
	print(1)
	print(u)
	exit()
_and = (v - u) // 2
c = int(u + _and)
d = int(_and)
if c ^ d == u:
	print(2)
	print(c, d)
	exit()
print(3)
print((v - u) // 2, u, (v - u) // 2)


(u, v) = map(int, input().split())
if u > v or u % 2 != v % 2:
	print(-1)
elif u == v:
	if u:
		print(1)
		print(v)
	else:
		print(0)
else:
	d = (v - u) // 2
	if d ^ u + d == u:
		print(2)
		print(d, u + d)
	else:
		print(3)
		print(d, d, u)


(a, b) = list(map(int, input().split()))
if a > b or (b - a) % 2 != 0:
	print(-1)
else:
	k = b - a
	if k == 0:
		if a == 0:
			print(0)
		else:
			print(1, '\n' + str(a))
	elif a & k // 2 == 0:
		print(2)
		print(a + k // 2, k // 2)
	else:
		print(3)
		print(a, k // 2, k // 2)


(u, v) = map(int, input().split())
if u > v:
	print(-1)
elif (v - u) % 2 == 1:
	print(-1)
else:
	x = (v - u) // 2
	if v == 0 and u == 0:
		print(0)
	elif v == u:
		print(1)
		print(u)
	elif x ^ u == x + u:
		print(2)
		print(x + u, x)
	else:
		print(3)
		print(x, x, u)


def main():
	(x, y) = list(map(int, input().split()))
	if x > y:
		print(-1)
	elif x == 0 and y == 0:
		print(0)
	elif x == y:
		print(1)
		print(x)
	elif y // 2 - x // 2 ^ y // 2 + (x + 1) // 2 == x and y // 2 - x // 2 + (y // 2 + (x + 1) // 2) == y:
		print(2)
		print(y // 2 - x // 2, y // 2 + (x + 1) // 2)
	elif (y - x) % 2 == 0:
		print(3)
		print(x, (y - x) // 2, (y - x) // 2)
	else:
		print(-1)
main()


def solve():
	(u, v) = map(int, input().split())
	if u % 2 != v % 2 or u > v:
		print(-1)
		return
	if u == v:
		if u:
			print(1)
			print(u)
		else:
			print(0)
		return
	x = (v - u) // 2
	if u & x:
		print(3)
		print(u, x, x)
	else:
		print(2)
		print(u ^ x, x)
solve()


from sys import stdin
import sys
tt = 1
for loop in range(tt):
	(u, v) = map(int, stdin.readline().split())
	if v == u == 0:
		print(0)
		sys.exit()
	if u % 2 != v % 2 or u > v:
		print(-1)
		sys.exit()
	if u == v:
		print(1)
		print(u)
		sys.exit()
	ans = [0, 0]
	ulis = []
	vrem = v
	for i in range(65):
		if 2 ** i & u > 0:
			vrem -= 2 ** i
			ans[0] += 2 ** i
		else:
			ulis.append(2 ** (i + 1))
	ulis.sort()
	ulis.reverse()
	for i in ulis:
		if i <= vrem:
			vrem -= i
			ans[0] += i // 2
			ans[1] += i // 2
	if ans[0] ^ ans[1] == u and ans[0] + ans[1] == v:
		print(2)
		print(*ans)
		sys.exit()
	print(3)
	print(*[u, (v - u) // 2, (v - u) // 2])


def main():
	(u, v) = readIntArr()
	ans = []
	if u > v:
		ans.append([-1])
	elif u == v:
		if u == 0:
			ans.append([0])
		else:
			ans.append([1])
			ans.append([u])
	else:
		w = v - u
		if w % 2 == 1:
			ans.append([-1])
		else:
			x = w // 2
			canFit = True
			i = 0
			while 2 ** i < 10 ** 18:
				if u & 1 << i > 0 and x & 1 << i > 0:
					canFit = False
				i += 1
			if canFit == True:
				ans.append([2])
				ans.append([u | x, x])
			else:
				ans.append([3])
				ans.append([u, x, x])
	multiLineArrayOfArraysPrint(ans)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]
inf = float('inf')
MOD = 10 ** 9 + 7
for _ in range(1):
	main()


def kset(n, k):
	if n >> k - 1 and 1:
		return 1
	else:
		return 0

def compute(S, X):
	A = (S - X) // 2
	a = 0
	b = 0
	for i in range(64):
		Ai = A & 1 << i
		Xi = X & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai != 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi != 0 and Ai == 0:
			a = 1 << i | a
		else:
			return [-1, -1]
	return [a, b]
	return [a, b]
ss = input().split()
x = int(ss[0])
s = int(ss[1])
if x == s == 0:
	print(0)
elif s == x and x != 0 and (s != 0):
	print(1)
	print(s)
elif s < x or (s - x) % 2 != 0:
	print(-1)
else:
	z = compute(s, x)
	if z[0] == -1:
		print(3)
		print((s - x) // 2, (s - x) // 2, x)
	else:
		print(2)
		print(z[0], z[1])


(a, b) = map(int, input().split())
x = (b - a) // 2
if a > b or (a - b) % 2:
	print(-1)
elif b == 0:
	print(0)
elif a == b:
	print(1)
	print(b)
elif x + a ^ x == a:
	print(2)
	print(x + a, x)
else:
	print(3)
	print((b - a) // 2, (b - a) // 2, a)


(u, v) = list(map(int, input().split()))
if v > u:
	if (v - u) % 2 == 0:
		b = (v - u) // 2
		if (u ^ b) + b == v:
			print(2)
			print(*[u ^ b, b])
		else:
			print(3)
			print(*[u, b, b])
	else:
		print(-1)
elif v == u:
	if u == 0:
		print(0)
	else:
		print(1)
		print(u)
else:
	print(-1)


from collections import defaultdict
(a, b) = map(int, input().strip().split())
bb = [0] * 64
ps = 0
cnt = [0] * 64
ma = 0
for i in range(64):
	b0 = a >> i & 1
	b1 = b >> i & 1
	if b0:
		cnt[i] += 1
		ps += 1
	if ps & 1 != b1:
		if i == 0:
			print(-1)
			exit(0)
		cnt[i - 1] += 2
		ps += 1
	ps = ps // 2
if ps:
	print(-1)
	exit(0)
for i in range(64):
	ma = max(ma, cnt[i])
ans = [0, 0, 0]
for i in range(64):
	for j in range(cnt[i]):
		ans[j] += 1 << i
print(ma)
answ = ''
for x in range(ma):
	answ += '{} '.format(ans[x])
print(answ)


(u, v) = map(int, input().split())
A = (v - u) // 2
if A < 0 or (v - u) % 2 != 0:
	print(-1)
elif u == 0 and v == 0:
	print(0)
else:
	a = 0
	b = 0
	c = 0
	for i in range(61):
		ui = u & 1 << i
		Ai = A & 1 << i
		if ui == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif ui > 0 and Ai == 0:
			a = 1 << i | a
		elif ui > 0 and Ai > 0:
			c = 1 << i | c
			a = 1 << i | a
			b = 1 << i | b
	if b == 0:
		print(1)
		print(a)
	elif c == 0:
		print(2)
		print(a, b)
	else:
		print(3)
		print(a, b, c)


(u, v) = map(int, input().split())
if u == 0 and v == 0:
	print(0)
	exit()
if u == v:
	print(1)
	print(u)
	exit()
if v < u or v - u & 1:
	print(-1)
	exit()
(a, b, c) = (u, (v - u) // 2, (v - u) // 2)
if a + b == a ^ b:
	print(2)
	print(a + b, c)
else:
	print(3)
	print(a, b, c)


from math import *
ap = [0] * 100

def check(x, te, a):
	n = len(a)
	ti = ceil(log(te, 2))
	ta = [0] * n
	while te > 0 and ti >= 0:
		if ti < len(a):
			tx = x
			if a[ti]:
				tx -= 1
			tx //= 2
			while te > 0 and tx > 0 and (te >= ap[ti]):
				te -= ap[ti]
				tx -= 1
				ta[ti] += 1
		ti -= 1
	if te == 0:
		return [True, ta]
	else:
		return [False]
(u, v) = map(int, input().split())
if u > v:
	print(-1)
elif u == v:
	if u == 0:
		print(0)
	else:
		print(1)
		print(u)
else:
	a = [int(i) for i in bin(u)[2:]]
	a.reverse()
	a += (len(bin(v)) - len(bin(u))) * [0]
	n = len(a)
	cp = 1
	ts = 0
	for i in range(n):
		if a[i]:
			ts += cp
		ap[i] = cp
		cp *= 2
	te = v - ts
	if te % 2 == 1:
		print(-1)
	else:
		te //= 2
		b = a[:]
		tb = 1 if 1 in a else 0
		lb = tb
		ub = 10 * n
		while lb + 1 < ub:
			tx = (ub + lb) // 2
			dx = (ub - lb) // 2
			if check(tx, te, a)[0]:
				ub -= dx
			else:
				lb += dx
		tx = (ub + lb) // 2
		for i in range(3):
			if tx > tb and check(tx - 1, te, a)[0]:
				tx -= 1
			elif not check(tx, te, a)[0]:
				tx += 1
		t2 = check(tx, te, a)[1]
		for i in range(n):
			a[i] += 2 * t2[i]
		tans = []
		while sum(a) > 0:
			tn = 0
			for i in range(n):
				if a[i] > 0:
					tn += ap[i]
					a[i] -= 1
			tans.append(tn)
		print(len(tans))
		print(' '.join(map(str, tans)))


(u, v) = list(map(int, input().split()))
ind = 0
if u > v or (v - u) % 2 == 1:
	print(-1)
elif v == 0:
	print(0)
elif u == v:
	print('1')
	print(u)
else:
	v = (v - u) // 2
	bit_u = [0] * 100
	bit_v = [0] * 100
	ind = 0
	while v > 0:
		if v % 2 == 1:
			bit_v[ind] = 1
		v = v // 2
		ind += 1
	ind = 0
	while u > 0:
		if u % 2 == 1:
			bit_u[ind] = 1
		u = u // 2
		ind += 1
	b = 1
	for i in range(0, 100):
		if bit_u[i] + bit_v[i] == 2:
			b = 0
	if b == 1:
		print(2)
		a1 = 0
		a2 = 0
		for i in range(0, 100):
			if bit_v[i] == 1:
				a1 += 1 << i
				a2 += 1 << i
			if bit_u[i] == 1:
				a2 += 1 << i
		print(str(a1) + ' ' + str(a2))
	else:
		print(3)
		a1 = 0
		a2 = 0
		a3 = 0
		for i in range(0, 100):
			if bit_u[i] + bit_v[i] == 2:
				a1 += 1 << i
				a2 += 1 << i
				a3 += 1 << i
			elif bit_v[i] == 1:
				a1 += 1 << i
				a2 += 1 << i
			elif bit_u[i] == 1:
				a2 += 1 << i
		print(str(a1) + ' ' + str(a2) + ' ' + str(a3))


(u, v) = map(int, input().split(' '))
if u > v or u % 2 != v % 2:
	print(-1)
elif u == v:
	if v:
		print(1)
		print(v)
	else:
		print(0)
else:
	x = (v + u) // 2
	y = (v - u) // 2
	if x ^ y == u:
		print(2)
		print(x, y)
	else:
		print(3)
		print(u, y, y)


def GETBIT(x, bit):
	return x >> bit & 1

def solve(u, v):
	if u > v:
		print(-1)
		return
	if v == 0:
		print(0)
		return
	v -= u
	if v == 0:
		print(1)
		print(u)
		return
	rs = 1
	lst = [0] * 3
	lst[0] += u
	if v % 2 == 1:
		print(-1)
		return
	for i in range(64):
		if GETBIT(v, i) == 1:
			if GETBIT(u, i - 1) == 1:
				rs = max(rs, 3)
				lst[1] += 1 << i - 1
				lst[2] += 1 << i - 1
			else:
				rs = max(rs, 2)
				lst[1] += 1 << i - 1
				lst[0] += 1 << i - 1
	print(rs)
	print(*(lst[i] for i in range(rs)))
(u, v) = map(int, input().split())
solve(u, v)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
			self.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')
import time
start_time = time.time()
import collections as col
import math
from functools import reduce

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

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def solve():
	(U, V) = getInts()
	if V == 0:
		print(0)
		return
	if U > V or (V - U) % 2 == 1:
		print(-1)
		return
	if U == V:
		print(1)
		print(U)
		return
	X = (V - U) // 2
	if not X & U:
		print(2)
		print(X + U, X)
	else:
		print(3)
		print(X, X, U)
	return
solve()


(n, m) = map(int, input().split())
if n > m:
	print(-1)
elif n == m:
	if n == 0:
		print(0)
	else:
		print(1)
		print(n)
elif (m - n) % 2 == 1:
	print(-1)
else:
	a = n
	b = (m - n) // 2
	if a ^ b == a + b:
		print(2)
		print(a ^ b, b)
	else:
		print(3)
		print(a, b, b)


from math import gcd
import sys

def input():
	return sys.stdin.readline().rstrip()

def slv():
	(u, v) = map(int, input().split())
	if u > v:
		print(-1)
		return
	if (v - u) % 2 != 0:
		print(-1)
		return
	if u == v:
		if u > 0:
			print(1)
			print(u)
		elif u == 0:
			print(0)
		return
	else:
		d = v - u >> 1
		flag = True
		(x, y) = (0, 0)
		for i in range(100):
			if d >> i & 1:
				if u >> i & 1:
					flag = False
					break
				else:
					x += 1 << i
					y += 1 << i
			elif u >> i & 1:
				x += 1 << i
				y += 0
		if flag:
			array = [x, y]
			assert x ^ y == u and x + y == v
			print(2)
			print(*array)
			return
	(x, y, z) = (u, 0, 0)
	d = v - u >> 1
	for i in range(100):
		if d >> i & 1:
			y += 1 << i
			z += 1 << i
	assert x ^ y ^ z == u and x + y + z == v
	print(3)
	array = [x, y, z]
	print(*array)
	return

def main():
	t = 1
	for _ in range(t):
		slv()
	return
main()


(a, b) = map(int, input().split())
if a > b:
	print(-1)
elif a == b:
	if a == 0:
		print(0)
	else:
		print(1)
		print(a)
else:
	idx = (b - a) // 2
	if a % 2 == b % 2:
		if a ^ idx != a + idx:
			print(3)
			print(a, idx, idx)
		else:
			print(2)
			print(a + idx, idx)
	else:
		print(-1)


(u, v) = list(map(int, input().split()))
if u > v or (v - u) % 2:
	print('-1')
elif u == v == 0:
	print('0\n')
elif u == v:
	print('1\n%d' % u)
else:
	diff = (v - u) // 2
	if diff & u == 0:
		print('2\n%d %d' % (u | diff, diff))
	else:
		print('3\n%d %d %d' % (diff, diff, u))


(a, b) = (int(i) for i in input().split(' '))
d = {}

def lowbit(u):
	return u & -u
if a > b or b - a & 1:
	print(-1)
elif b == a and a == 0:
	print(0)
elif b == a:
	print(1)
	print(a)
else:
	a1 = a
	a2 = b - a >> 1
	if a2 & a1:
		print(3)
		print(a1, a2, a2)
	else:
		print(2)
		print(a1 + a2, a2)


def sol():
	(u, v) = map(int, input().split())
	if u > v or (u - v) % 2 != 0:
		return -1
	if u == v:
		if u == 0:
			return 0
		else:
			return '1\n%d' % u
	x = (v - u) // 2
	(a, b) = (0, 0)
	i = 1
	u_ = u
	x_ = x
	while u_ or x_:
		(m, n) = (u_ % 2, x_ % 2)
		if n == 1:
			if m == 1:
				return '3\n{} {} {}'.format(u, x, x)
			else:
				a += i
				b += i
		elif m == 1:
			a += i
		u_ //= 2
		x_ //= 2
		i *= 2
	return '2\n%d %d' % (a, b)
print(sol())


(x, s) = map(int, input().split())
if x > s:
	print(-1)
elif (s - x) % 2 == 1:
	print(-1)
elif s == 0:
	print(0)
elif s == x:
	print(1)
	print(s)
elif x | s - x >> 1 == x + (s - x >> 1):
	print(2)
	print(x + (s - x >> 1), s - x >> 1)
else:
	print(3)
	print(x, s - x >> 1, s - x >> 1)


(xor, sm) = map(int, input().split())
diff = sm - xor
if diff < 0 or diff % 2:
	l = -1
elif xor == sm == 0:
	l = 0
elif xor == sm:
	l = 1
	ans = [sm]
else:
	l = 2
	for i in range(60):
		if xor >> i & diff >> i + 1:
			l = 3
	ans = [0] * l
	for i in range(60):
		j = 0
		if xor >> i & 1:
			ans[j] += 1 << i
			j += 1
		if diff >> i + 1 & 1:
			ans[j] += 1 << i
			ans[j + 1] += 1 << i
			j += 2
print(l)
if l > 0:
	print(*ans)


def run():
	(xo, s) = list(map(int, input().split()))
	if s < xo:
		print(-1)
		return
	if s == xo:
		if s != 0:
			print(1)
		print(xo)
		return
	if (s - xo) % 2 != 0:
		print(-1)
		return
	an = (s - xo) // 2
	an_binary = '{0:b}'.format(an)
	xo_binary = '{0:b}'.format(xo)
	xo_binary = xo_binary.rjust(len(an_binary), '0')
	an_binary = an_binary.rjust(len(xo_binary), '0')
	include_c = False
	for i in range(len(xo_binary)):
		if an_binary[i] == '1' and xo_binary[i] == '1':
			include_c = True
			break
	if not include_c:
		a = xo + an
		b = an
		print(2)
		print(str(a) + ' ' + str(b))
	else:
		a = xo
		b = an
		print(3)
		print(str(a) + ' ' + str(b) + ' ' + str(b))
run()


import math

def main():
	(u, v) = map(int, input().split())
	v -= u
	if u == v == 0:
		print(0)
		return
	if v < 0:
		print('-1')
		return
	if v == 0:
		print(1)
		print(u)
		return
	if v % 2 != 0:
		print('-1')
		return
	elif v // 2 & u != 0:
		print(3)
		print(u, v // 2, v // 2)
		return
	else:
		print(2)
		print(u + v // 2, v // 2)
		return
t = 1
for i in range(t):
	main()


from math import gcd
(u, v) = map(int, input().split())
if u == 0 and v == 0:
	print(0)
elif v < u or u % 2 != v % 2:
	print(-1)
elif u == v:
	print(1)
	print(u)
else:
	m = (v - u) // 2
	if m & u == 0:
		print(2)
		print(m, m | u)
	else:
		print(3)
		print(u, m, m)


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l
import statistics

def main():
	(x, y) = cin()
	if x == 0 and y == 0:
		print(0)
	elif x == y:
		print(1)
		print(x)
	elif abs(x - y) % 2 == 1 or x > y:
		print(-1)
	else:
		y = y - x
		y = y // 2
		yy = y
		xx = x
		pp = 0
		while yy > 0:
			if yy % 2 == 1 and xx % 2 == 1:
				pp = 1
				break
			xx //= 2
			yy //= 2
		if pp == 1:
			print(3)
			print(y, y, x)
		else:
			print(2)
			print(y, x + y)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


(u, v) = map(int, input().split())
if v < u:
	print(-1)
elif v == u == 0:
	print(0)
elif v == u:
	print(1)
	print(u)
elif v % 2 != u % 2:
	print(-1)
else:
	y = (v - u) // 2
	a = u + y
	b = y
	if a + b == v and a ^ b == u:
		print(2)
		print(u + y, y)
	else:
		print(3)
		print(u, y, y)


import statistics
import math
import datetime
import collections

def identity(*args):
	if len(args) == 1:
		return args[0]
	return args

def parsin(*, l=1, vpl=1, cf=identity, s=' '):
	if l == 1:
		if vpl == 1:
			return cf(input())
		else:
			return list(map(cf, input().split(s)))
	elif vpl == 1:
		return [cf(input()) for _ in range(l)]
	else:
		return [list(map(cf, input().split(s))) for _ in range(l)]

def odw(l):
	wyn = 0
	pot = 1
	for i in l:
		wyn += pot * i
		pot *= 2
	return wyn

def konw(n):
	l = []
	while n > 0:
		l.append(n % 2)
		n //= 2
	return l

def main():
	(x, s) = map(int, input().split())
	xx = konw(x)
	ss = konw(s)
	if x == 0 and s == 0:
		print(0)
	else:
		if x > s:
			print(-1)
		if x == s:
			print(1)
			print(x)
		if x < s:
			if (x - s) % 2 == 1:
				print(-1)
			else:
				kan1 = []
				kan2 = []
				for i in range(len(xx)):
					if xx[i] == 0:
						kan1.append(0)
						kan2.append(0)
					else:
						kan1.append(1)
						kan2.append(0)
				for j in range(len(xx), len(ss)):
					kan1.append(0)
					kan2.append(0)
				ind = len(ss) - 1
				while odw(kan1) + odw(kan2) < s:
					while ind >= 0:
						if not (kan1[ind] == kan2[ind] and kan1[ind] == 0):
							ind -= 1
						elif 2 ** (ind + 1) + odw(kan1) + odw(kan2) > s:
							ind -= 1
						else:
							break
					if ind == -1:
						break
					kan1[ind] = 1
					kan2[ind] = 1
				if odw(kan1) + odw(kan2) == s:
					print(2)
					print(odw(kan1), odw(kan2))
				else:
					print(3)
					print(x, (s - x) // 2, (s - x) // 2)
	pass
main()


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
(n, k) = invr()
if k < n or abs(k - n) % 2 != 0:
	print(-1)
elif n == 0 == k:
	print(0)
elif n == k:
	print(1)
	print(n)
else:
	mp = {}
	nd = (k - n) // 2
	a = nd + n
	if a ^ nd == n:
		print(2)
		print(a, nd)
	else:
		print(3)
		print(n, (k - n) // 2, (k - n) // 2)


from collections import defaultdict as dc
from collections import deque as dq
from bisect import bisect_left, bisect_right, insort_left
import sys
import math
mod = 10 ** 9 + 7

def rem(p, q):
	z = p // q
	r = p - q * z
	return r

def inp():
	p = int(input())
	return p

def line():
	p = list(map(int, input().split()))
	return p

def count(n):
	if n <= 0:
		return 0
	return n * (n + 1) // 2

def count(n):
	p = bin(n)[2:]
	return p.count('1')

def ans(x, s):
	p = bin(x)[2:]
	q = bin(s)[2:]
	if len(p) > len(q):
		q = '0' * (len(p) - len(q)) + q
	else:
		p = '0' * (len(q) - len(p)) + p
	ans1 = ''
	ans2 = ''
	for i in range(len(p)):
		if p[i] == '0' and q[i] == '0':
			ans1 += '0'
			ans2 += '0'
		elif p[i] == '0' and q[i] == '1':
			ans1 += '1'
			ans2 += '1'
		elif p[i] == '1' and q[i] == '0':
			ans1 += '0'
			ans2 += '1'
		else:
			return (-1, -1)
	return (int(ans1, 2), int(ans2, 2))
(xor, s) = line()
if xor > s:
	print(-1)
elif s == 0:
	print(0)
elif s == xor:
	print(1)
	print(s)
else:
	x = s - xor
	x = x // 2
	(a, b) = ans(xor, x)
	if a == -1:
		if xor + x + x == s:
			print(3)
			print(xor, x, x)
		else:
			print(-1)
	elif a + b == s and a ^ b == xor:
		print(2)
		print(a, b)
	else:
		print(-1)


(x, y) = map(int, input().split())
if x == 0 and y == 0:
	print(0)
elif x == y:
	print(1)
	print(x)
elif abs(x - y) % 2 == 1 or x > y:
	print(-1)
else:
	y = y - x
	y = y // 2
	yy = y
	xx = x
	p = 0
	while yy > 0:
		if yy % 2 == 1 and xx % 2 == 1:
			p = 1
			break
		xx //= 2
		yy //= 2
	if p == 1:
		print(3)
		print(y, y, x)
	else:
		print(2)
		print(y, x + y)


def main():
	(u, v) = map(int, input().split())
	if u > v:
		print(-1)
		return
	if u == v:
		if u == 0:
			print(0)
			return
		print(1)
		print(u)
		return
	diff = v - u
	if diff % 2 == 0:
		arr = [u, diff // 2, diff // 2]
		a = diff // 2
		b = v - a
		if a & b == diff // 2:
			arr = [a, b]
	else:
		print(-1)
		return
	print(len(arr))
	for i in arr:
		print(i, end=' ')
main()


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(u, v) = I()
if u > v:
	print(-1)
	exit()
if u == v and u:
	print(1)
	print(u)
	exit()
if u == v and (not u):
	print(0)
	exit()
ans = []
(cu, cv) = (u, v)

def mask(x, bit):
	return x >> bit & 1
d = dd(int)
v -= u
if v % 2:
	print(-1)
	exit()
for i in range(65, -1, -1):
	if mask(u, i):
		ans.append(2 ** i)
for bit in range(65, 0, -1):
	if mask(v, bit):
		value = 2 ** (bit - 1)
		d[bit - 1] = 1
		ans.append(value)
		ans.append(value)
res = []
while ans:
	sum = 0
	for i in set(ans):
		ans.remove(i)
		sum += i
	res.append(sum)
print(len(res))
print(*res)


(n, m) = map(int, input().split())
x = (m - n) // 2
if n > m or (n - m) % 2:
	print(-1)
elif m == 0:
	print(0)
elif n == m:
	print(1)
	print(n)
elif x + n ^ x == n:
	print(2)
	print(x + n, x)
else:
	print(3)
	print(x, x, n)


(u, v) = map(int, input().split())

def d(v=-1):
	print(v)
	exit(0)
if u > v:
	d()
if u == v:
	if u == 0:
		d(0)
	else:
		print(1)
		d(u)
bit_u = [0] * 600
bit_v = [0] * 600
for i in range(64):
	if 1 << i & u:
		bit_u[i] = 1
	if 1 << i & v:
		bit_v[i] = 1
for i in range(63, 0, -1):
	if bit_u[i] == bit_v[i] % 2:
		bit_v[i - 1] += bit_v[i] >> 1 << 2
		bit_v[i] %= 2
	else:
		if bit_v[i] == 0:
			d()
		bit_v[i] -= 1
		bit_v[i - 1] += 2
		bit_v[i - 1] += bit_v[i] >> 1 << 2
		bit_v[i] %= 2
for i in range(500):
	up = bit_v[i] >> 2 << 1
	bit_v[i + 1] += up
	bit_v[i] -= up << 1
n = max(bit_v)
res = [0] * n
for i in range(n):
	for j in range(600):
		if bit_v[j] > i:
			res[i] |= 1 << j
(xr, sm) = (0, 0)
for i in res:
	xr ^= i
	sm += i
if xr != u or sm != v:
	d()
	exit(0)
print(n)
print(*res)


import os
import sys
from math import *
from collections import *
from fractions import *
from heapq import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(xor, s) = value()
orig = s
ele = 0
s -= xor
if s < 0 or s % 2:
	print(-1)
else:
	first = orig - s
	second = s // 2
	third = s // 2
	if first & third == 0:
		first += third
		third = 0
	ans = [i for i in (first, second, third) if i]
	print(len(ans))
	print(*ans)


import math
import sys
(u, v) = map(int, input().split())
if u > v or u % 2 != v % 2:
	print(-1)
	sys.exit()
if u == v == 0:
	print(0)
	sys.exit()
if u == v:
	print(1)
	print(u)
	sys.exit()
curv = v
x = (v - u) // 2
if u & x:
	print(3)
	print(u, x, x)
else:
	print(2)
	print(u ^ x, x)


import sys
input = sys.stdin.readline

def main():
	(U, V) = [int(x) for x in input().split()]
	if U > V:
		print(-1)
		return
	if V == 0:
		print(0)
		return
	if U == V:
		print(1)
		print(U)
		return
	if abs(U - V) % 2 != 0:
		print(-1)
		return
	if (V - U) // 2 & U == 0:
		print(2)
		print((V - U) // 2, U + (V - U) // 2)
	else:
		print(3)
		print((V - U) // 2, (V - U) // 2, U)
main()


(u, v) = map(int, input().split())
bits = [0] * 61
i = 0
if u & 1 != v & 1:
	print(-1)
else:
	c = 0
	while u or v:
		a = u & 1
		b = v & 1
		if a == 1 and b == 1:
			bits[i] += 1
			if c == 1:
				bits[i - 1] += 2
		elif a == 1 and b == 0:
			bits[i] += 1
			if c != 1:
				bits[i - 1] += 2
				c = 1
		elif a == 0 and b == 1:
			if c != 1:
				bits[i - 1] += 2
			else:
				c -= 1
		elif a == 0 and b == 0:
			if c == 1:
				bits[i - 1] += 2
		i += 1
		u >>= 1
		v >>= 1
	if c != 0:
		print(-1)
	else:
		mbit = max(bits)
		A = []
		for j in range(mbit):
			s = ''
			for i in range(len(bits)):
				if bits[i] >= j + 1:
					s = '1' + s
				else:
					s = '0' + s
			A.append(int(s, 2))
		print(mbit)
		print(*A)


bit = 67
(x, s) = map(int, input().split())
if x == s:
	if s != 0:
		print(1)
		print(s)
	else:
		print(0)
	exit(0)
s -= x
if s < 0 or s & 1:
	print(-1)
	exit(0)
a = 0
for i in range(1, bit):
	if s >> i & 1:
		a += 1 << i - 1
if a & x:
	print(3)
	print(a, a, x)
else:
	x |= a
	print(2)
	print(a, x)


import sys
import heapq
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [[val for i in range(n)] for j in range(m)]

def two(n):
	if n == 0:
		return True
	i = 0
	while i <= 64:
		if n == pow(i, 2):
			return True
		i += 1
	return False
(u, v) = sp()
if u + v == 0:
	print(0)
	exit()
if u > v:
	print(-1)
	exit()
if u % 2 + v % 2 == 1:
	print(-1)
	exit()
if u == v:
	print(1)
	print(u)
	exit()
x = (v - u) // 2
if u & x:
	print(3)
	print(u, x, x)
	exit()
print(2)
print(u + x, x)


(v, u) = map(int, input().split())
count = [0] * 100
index = 0
works = True
while u >= 0 and v >= 0 and (v > 0 or u > 0):
	u2 = u & 1
	v2 = v & 1
	if u2 != v2:
		u -= 1
		if index:
			count[index - 1] += 2
		else:
			works = False
			break
	elif u2:
		u -= 1
		v -= 1
		count[index] += 1
	else:
		u >>= 1
		v >>= 1
		index += 1
if works and u >= 0 and (v >= 0):
	out = []
	for i in range(100):
		while len(out) < count[i]:
			out.append(0)
		for j in range(count[i]):
			out[j] ^= 1 << i
	print(len(out))
	print(' '.join(map(str, out)))
else:
	print(-1)


import sys, os, io
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
import math

def ncr(n, r, p):
	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 primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def si():
	return input()

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

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

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = 1
for _ in range(t):
	(u, v) = li()
	if (u - v) % 2 == 1 or u > v:
		print(-1)
		continue
	if u == 0 and v == 0:
		print(0)
		continue
	if u == v:
		print(1)
		print(u)
		continue
	diff = (v - u) // 2
	temp = diff
	diff = bin(diff)[2:][::-1]
	binu = bin(u)[2:][::-1]
	f = 0
	for i in range(min(len(diff), len(binu))):
		if diff[i] == binu[i] == '1':
			print(3)
			print(temp, temp, u)
			f = 1
			break
	if f == 0:
		print(2)
		print(u + temp, temp)


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
(u, v) = MAP()
if v < u:
	print(-1)
	exit()
cnt = [0] * 61
for k in range(61):
	if u & 1 << k:
		cnt[k] += 1
need = v - u
for k in range(60, -1, -1):
	if (1 << k) * 2 <= need:
		(di, mo) = divmod(need, (1 << k) * 2)
		cnt[k] += 2 * di
		need = mo
if need != 0:
	print(-1)
	exit()
ans = [0] * max(cnt)
for (k, v) in enumerate(cnt):
	for i in range(v):
		ans[i] |= 1 << k
print(len(ans))
if ans:
	print(*ans)


import sys
import math
input = sys.stdin.readline
t = 1
for _ in range(t):
	(u, v) = map(int, input().split())
	if (u + v) % 2 != 0 or u > v:
		print(-1)
	elif u == v and u == 0:
		print(u)
	elif u == v:
		print(1)
		print(u)
	else:
		an = (v - u) // 2
		a = 0
		b = 0
		ch = 1
		for i in range(60):
			if an & 1 << i > 0 and u & 1 << i == 0:
				a = a | 1 << i
				b = b | 1 << i
			if an & 1 << i > 0 and u & 1 << i > 0:
				ch = 0
				break
			if an & 1 << i == 0 and u & 1 << i > 0:
				a = a | 1 << i
		if ch == 0:
			print(3)
			print(u, an, an)
		else:
			print(2)
			print(a, b)


from sys import stdin, stdout

def main():
	(a, b) = list(map(int, stdin.readline().split()))
	if a == 0:
		if b == 0:
			print('0')
			return
		elif b % 2 == 0:
			print('2')
			print(str(int(b / 2)) + ' ' + str(int(b / 2)))
			return
		else:
			print('-1')
			return
	ans = []
	b -= a
	if b == 0:
		print('1')
		print(a)
		return
	if b % 2 == 1 or b < 0:
		print('-1')
		return
	half = b >> 1
	if half | a == half + a:
		print('2')
		print(half + a, half)
	else:
		print('3')
		print(half, half, a)
main()


import math, collections, sys
input = sys.stdin.readline
(u, v) = map(int, input().split())
if u > v:
	print(-1)
	exit()
if (v - u) % 2:
	print(-1)
	exit()
if v == u:
	if v == 0:
		print(0)
		exit()
	print(1)
	print(u)
	exit()
if (v - u) // 2 ^ u == (v - u) // 2 + u:
	print(2)
	print((v - u) // 2, u ^ (v - u) // 2)
else:
	print(3)
	print((v - u) // 2, (v - u) // 2, u)


def linput(a):
	return [int(i) for i in a.split()]
for ughblnk in range(1):
	(u, v) = linput(input())
	if u > v:
		print(-1)
	elif u % 2 != v % 2:
		print(-1)
	elif u == 0 and v == 0:
		print(0)
	elif u == v:
		print(1)
		print(u)
	else:
		t = (v - u) // 2
		bu = bin(u)[2:][::-1]
		bt = bin(t)[2:][::-1]
		(i, q) = (0, 0)
		while i < len(bu) and i < len(bt) and (q == 0):
			if bu[i] == bt[i] and bu[i] == '1':
				q = 1
			i += 1
		if q == 1:
			print(3)
			print(u, t, t)
		else:
			print(2)
			print(u + t, t)


def codechef(s, x):
	if s == x == 0:
		print(0)
	elif s == x != 0:
		print(1)
		print(s)
	else:
		a = (s - x) // 2
		if s - x & 1:
			print(-1)
		elif a < 0:
			print(-1)
		elif x & a == 0:
			print(2)
			print(int(x + a), int(a))
		else:
			print(3)
			print(int(x), int(a), int(a))
(x, s) = map(int, input().split())
codechef(s, x)


ch = input()
L = [int(i) for i in ch.split()]
a = L[0]
b = L[1]
if a > b:
	print(-1)
elif a == b:
	if a == 0:
		print(a)
	else:
		print(1)
		print(a)
elif (b - a) % 2 == 1:
	print(-1)
elif a & (b - a) // 2 == 0:
	print(2)
	print(a + (b - a) // 2, (b - a) // 2)
else:
	print(3)
	print(a, (b - a) // 2, (b - a) // 2)


import sys

def input():
	return sys.stdin.readline()

def iinput():
	return int(input())

def rinput():
	return input().split()

def rlinput():
	return [int(i) for i in input().split()]

def main():
	q = [0] * 100
	(u, v) = rlinput()
	if u <= v:
		if v == 0:
			print(0)
			return 0
		if v == u:
			print(1)
			print(v)
			return 0
		if (v - u) % 2 == 1:
			print(-1)
			return 0
		fl = True
		for i in range(70):
			if v - u & 1 << i:
				q[i - 1] += 1
				if u & 1 << i - 1:
					fl = False
		w = [u, 0]
		if fl:
			for i in range(70):
				if q[i]:
					w[1] += 1 << i
					w[0] += 1 << i
		else:
			w.append(0)
			for i in range(70):
				if q[i]:
					w[1] += 1 << i
					w[2] += 1 << i
		print(len(w))
		print(*w)
	else:
		print(-1)
for i in range(1):
	main()


(u, v) = map(int, input().split())
if u > v or u % 2 != v % 2:
	print('-1')
elif u == 0 and v == 0:
	print('0')
elif u == v:
	print('1\n')
	print(u)
else:
	x = int((v - u) // 2)
	if u & x == 0:
		print('2')
		print(u + x, x, sep=' ')
	else:
		print('3')
		print(u, x, x, sep=' ')


def solve(u, v):
	if u > v or (v - u) % 2 == 1:
		return None
	if u == v == 0:
		return []
	if u == v:
		return [u]
	w = (v - u) // 2
	if not w & u:
		return [w, v - w]
	return [u, w, w]
(u, v) = map(int, input().split())
a = solve(u, v)
if a is None:
	print(-1)
else:
	print(len(a))
	print(*a)


(x, s) = map(int, input().split())
if x == 0 and s == 0:
	print(0)
	exit()
if x > s:
	print(-1)
	exit()
if x & 1 != s & 1:
	print(-1)
	exit()
if x == s:
	print(1)
	print(x)
	exit()
if x == 0:
	print(2)
	print(s // 2, s // 2)
	exit()
b = (s - x) // 2
f = 1
bx = bin(x)[2:]
ba = ''
bb = bin(b)[2:]
while len(bb) < len(bx):
	bb = '0' + bb
while len(bx) < len(bb):
	bx = '0' + bx
for i in range(len(bx)):
	if bb[i] == '1':
		ba += '1'
	elif bb[i] == '0' and bx[i] == '1':
		ba += '1'
	else:
		ba += '0'
a = int(ba, 2)
if a ^ b == x and a + b == s:
	print(2)
	print(a, b)
	exit()
print(3)
print(x, (s - x) // 2, (s - x) // 2)


from math import ceil, log, floor, sqrt

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def find_product(n, m, arr):
	product = 1
	if n <= m:
		for i in range(n):
			for j in range(i + 1, n):
				product = product * abs(arr[i] - arr[j]) % m
		return product
	return 0

def count_tables(l):
	count = 0
	l.sort()
	a = l[1] - l[0]
	b = l[2] - l[0]
	if a % 3 > 0 and a % 3 + (b - (a - a % 3)) >= 3:
		count += 1
	count += l[0] + 2 * a // 3
	return int(min(sum(l) / 3, l[0] + l[1]))

def find_possible_weight(W, arr):
	w = 0
	for i in range(8, 0, -1):
		count = min(arr[i - 1], W // i)
		w += count * i
		W -= count * i
	return w

def find_divisor(a):
	divisors = []
	for i in range(2, min(a, ceil(sqrt(a)) + 1)):
		if a % i == 0:
			if a / i == i:
				divisors.append(i)
			else:
				divisors.append(i)
				divisors.append(a / i)
	if len(divisors) == 0:
		return -1
	return int(min(divisors))

def find_arr(u, v):
	res = []
	if u % 2 != v % 2 or u > v:
		return res
	if u == v:
		res = [u]
		return res
	x = (v - u) // 2
	if u & x:
		res = [u, x, x]
	else:
		res = [u ^ x, x]
	return res

def get_divisors(n, arr):
	d1 = []
	d2 = []
	for i in range(n):
		spf = find_divisor(arr[i])
		if spf == -1:
			d1.append(-1)
			d2.append(-1)
		else:
			while arr[i] % spf == 0:
				arr[i] /= spf
			if arr[i] != 1:
				d1.append(int(arr[i]))
				d2.append(spf)
			else:
				d1.append(-1)
				d2.append(-1)
	print(*d1, sep=' ')
	print(*d2, sep=' ')

def find_max_gcd(a):
	degree = ceil(log(a) / log(2))
	m = pow(2, degree) - 1
	if a == m:
		return find_divisor(a)
	if a == m + 1:
		m = 2 * a - 1
	return m
t = 1
while t:
	t = t - 1
	(u, v) = map(int, input().split())
	if u == v and u == 0:
		print(0)
	else:
		res = find_arr(u, v)
		if len(res) == 0:
			print(-1)
		else:
			print(len(res))
			print(*res, sep=' ')


(xor, sum) = map(int, input().split())
answer = []
if xor > sum or sum - xor & 1:
	print(-1)
	exit()
elif xor == sum:
	if xor == 0:
		print(0)
		exit()
	answer.append(xor)
else:
	carry = False
	(X, S) = (xor, sum)
	(xor, sum) = (bin(xor)[2:][::-1], bin(sum)[2:][::-1])
	xor = xor + '0' * (len(sum) - len(xor))
	answer = ['', '']
	for (index, bit_xor, bit_sum) in zip(range(len(xor)), xor, sum):
		if bit_xor == bit_sum == '1' and (not carry):
			answer[0] += '1'
			answer[1] += '0'
		elif bit_sum == bit_xor == '0' and (not carry):
			if index < len(xor) - 1 and sum[index + 1] != xor[index + 1]:
				carry = True
				answer[0] += '1'
				answer[1] += '1'
			else:
				answer[0] += '0'
				answer[1] += '0'
		elif bit_sum == '1' and bit_xor == '0' and carry:
			if index < len(sum) - 1 and sum[index + 1] != xor[index + 1]:
				answer[0] += '1'
				answer[1] += '1'
			else:
				carry = False
				answer[0] += '0'
				answer[1] += '0'
		elif bit_sum == '0' and bit_xor == '1' and carry:
			answer[0] += '1'
			answer[1] += '0'
		else:
			answer = [X, (S - X) // 2, (S - X) // 2]
			carry = None
			break
	if carry == True:
		answer[0].append('1')
	if carry != None:
		answer = [int(x[::-1], 2) for x in answer]
print(str(len(answer)) + '\n' + ''.join((str(x) + ' ' for x in answer)))


def solve():
	(u, v) = map(int, input().split())
	if abs(u - v) % 2 != 0 or u > v:
		return -1
	elif u == v:
		return f'{1}\n{u}' if u != 0 else '0'
	else:
		x = (v - u) // 2
		if u & x:
			return f'3\n{u} {x} {x}'
		else:
			return f'2\n{u ^ x} {x}'
print(solve())


import sys
input = sys.stdin.readline

def solve():
	(u, v) = map(int, input().split())
	if u == 0:
		if v == 0:
			print(0)
			return
		if v % 2 == 1:
			print(-1)
			return
		print(2)
		print(v // 2, v // 2)
		return
	if u > v:
		print(-1)
		return
	if u == v:
		print(1)
		print(u)
		return
	if u < v:
		if (v - u) % 2 == 1:
			print(-1)
			return
		vu = (v - u) // 2
		if u + vu == u ^ vu:
			print(2)
			print(u + vu, vu)
			return
		print(3)
		print(u, vu, vu)
		return
solve()


(u, v) = list(map(int, input().split()))

def function(u, y):
	dict1 = {}
	a = bin(u)[2:]
	b = len(a)
	for i in range(b):
		if a[i] == '1':
			dict1[b - i] = 1
	c = bin(y)[2:]
	d = len(c)
	for i in range(d):
		if c[i] == '1':
			if d - i in dict1.keys():
				return False
	return True
if u > v:
	print(-1)
elif u == v:
	if u == 0:
		print(0)
	else:
		print(1)
		print(u)
else:
	x = v - u
	if x % 2 == 1:
		print(-1)
	else:
		y = x // 2
		if function(u, y):
			print(2)
			print(u | y, y)
		else:
			print(3)
			print(y, y, u)


def calc():
	tot = 2
	a = u
	b = 0
	c = 0
	d = v - u
	nb = 0
	while d > 0:
		if d & 1:
			if 1 << nb - 1 & a:
				tot = 3
				b += 1 << nb - 1
				c += 1 << nb - 1
			else:
				a += 1 << nb - 1
				b += 1 << nb - 1
		d >>= 1
		nb += 1
	return [a, b, c, tot]
(u, v) = map(int, input().split())
if u == v and u == 0:
	print(0)
	exit(0)
if u > v:
	print(-1)
elif u == v:
	print(1)
	print(u)
elif v - u & 1:
	print(-1)
else:
	ans = calc()
	print(ans[-1])
	print(ans[0], ans[1], end=' ')
	if ans[-1] == 3:
		print(ans[2])


import math as m

def f1():
	Testcases = int(input())
	for i in range(0, Testcases):
		x = int(input())
		print(str(x - 1) + str(' ') + str(1))

def f2():
	Testcases = int(input())
	for i in range(0, Testcases):
		n = int(input())
		array = [int(j) for j in input().split(' ')]
		answer = len(array)
		dict1 = dict()
		for k in array:
			if k in dict1:
				answer = answer - 1
			else:
				dict1[k] = 1
		print(answer)

def f4():
	array = [int(i) for i in input().split(' ')]
	u = array[0]
	v = array[1]
	if u == v and v == 0:
		print(0)
		return
	if u == v:
		print(1)
		print(u)
		return
	if u > v:
		print(-1)
		return
	if u % 2 == 0 and v % 2 != 0:
		print(-1)
		return
	if u % 2 != 0 and v % 2 == 0:
		print(-1)
		return
	x = (array[1] - array[0]) // 2
	if u & x != 0:
		print(3)
		print(u, x, x)
	else:
		print(2)
		print(u + x, x)

def f3():
	Node = int(input())
	dict1 = dict()
	edgeset = list()
	for i in range(0, Node):
		edgeset.append(list())
	for i in range(0, Node - 1):
		edge = input().split(' ')
		u = int(edge[0])
		v = int(edge[1])
		if u < v:
			dict1[u - 1, v - 1] = 0
		else:
			dict1[v - 1, u - 1] = 0
		edgeset[u - 1].append(v - 1)
		edgeset[v - 1].append(u - 1)
	for i in range(0, len(edgeset)):
		for j in range(0, len(edgeset)):
			visited = [False] * len(edgeset)
			DFS(edgeset, i, j, dict1, visited)
	list2 = list()
	for x in dict1.items():
		list2.append((x[0][0], x[0][1], x[1]))
	list2.sort(key=lambda x: x[2])
	d = Node - 2
	list1 = list()
	for i in range(0, len(list2)):
		list1.append((list2[i][0], list2[i][1], d))
		d = d - 1
	list1.sort(key=lambda x: x[0])
	for i in range(0, len(list1)):
		print(list1[i][2])

def DFS(edgeset, i, j, dict1, visited):
	visited[i] = True
	if i == j:
		return True
	for vert in edgeset[i]:
		if visited[vert] == False:
			X = DFS(edgeset, vert, j, dict1, visited)
			if X == True:
				(a, b) = (i, vert)
				if i > vert:
					b = i
					a = vert
				dict1[a, b] = dict1[a, b] + 1
				return True
	return False

def BFS(edgeset, vert, j, dict1):
	Q = list()
	Q.append(vert)
	visited = [False] * len(edgeset)
	visited[vert] = True
	while len(Q) != 0:
		v = Q.pop()
		if v == j:
			return dict1
		for vertex in edgeset[v]:
			if visited[vertex] == False:
				visited[vertex] = True
				(a, b) = (0, 0)
				if v < vertex:
					a = v
					b = vertex
				else:
					a = vertex
					b = v
				dict1[a, b] = dict1[a, b] + 1
				Q.append(vertex)
	return dict1
f4()


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')
(u, v) = map(int, input().split())
if u > v:
	print(-1)
elif u == v:
	if u == 0:
		print(0)
	else:
		print(1)
		print(u)
elif (v - u) % 2 == 0:
	ar1 = [u + (v - u) // 2, (v - u) // 2]
	ar2 = [u, (v - u) // 2, (v - u) // 2]
	if ar1[0] ^ ar1[1] == u:
		print(2)
		print(*ar1)
	else:
		print(3)
		print(*ar2)
else:
	print(-1)


(XOR, SUM) = map(int, input().split())
if XOR > SUM or XOR % 2 != SUM % 2:
	print(-1)
elif SUM == 0:
	print(0)
elif XOR == SUM:
	print(1)
	print(SUM)
else:
	a = (SUM - XOR) // 2
	if a ^ XOR == a + XOR:
		print(2)
		print(a ^ XOR, a)
	else:
		print(3)
		print(a, a, XOR)


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
(u, v) = rinput()
if u == 0 and v == 0:
	print(0)
elif u > v or (v - u) % 2:
	print(-1)
elif u == v:
	print(1)
	print(u)
elif u + (v - u) // 2 ^ (v - u) // 2 == u:
	print(2)
	print(u + (v - u) // 2, (v - u) // 2)
else:
	print(3)
	print((v - u) // 2, (v - u) // 2, u)


(u, v) = [int(x) for x in input().split()]
if u == 0 and v == 0:
	print(0)
	exit(0)
if u == v:
	print(1)
	print(u)
	exit(0)
if u > v or (u - v) % 2 == 1:
	print(-1)
	exit(0)
result = 0
tmp_u = u
tmp_and = v - u >> 1
x = tmp_and
i = 0
j = 0
while tmp_u > 0 or tmp_and > 0:
	a = tmp_and % 2
	b = tmp_u % 2
	if a == 1:
		if b == 1:
			print(3)
			print(u, x, x)
			exit(0)
		if b == 0:
			result = result + (1 << i)
	if b == 1:
		j = i
	tmp_u = tmp_u >> 1
	tmp_and = tmp_and >> 1
	i += 1
print(2)
print(result, v - result)


(xor, sm) = map(int, input().split())
if xor > sm:
	print('-1')
elif xor % 2 != sm % 2:
	print('-1')
elif xor == 0 and sm == 0:
	print('0')
elif xor == 0:
	print('2')
	v = sm // 2
	print(v, v)
elif xor == 1 and sm == 1:
	print('1')
	print('1')
elif xor == sm:
	print('1')
	print(xor)
else:
	val = sm - xor
	val //= 2
	AND = val
	a = 0
	b = 0
	bl = True
	for i in range(64):
		x1 = xor & 1 << i
		and2 = AND & 1 << i
		if x1 == 0 and and2 == 0:
			continue
		elif x1 == 0 and and2 > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif x1 > 0 and and2 == 0:
			a = 1 << i | a
		else:
			bl = False
			break
	if bl == True:
		print('2')
		print(a, b)
	else:
		print('3')
		print(val, val, xor)


(u, v) = map(int, input().split())

def xorcise(u, v):
	if u > v or v & 1 != u & 1:
		print(-1)
		return
	m = v.bit_length()
	r_bits = list(map(int, reversed(format(v - u, 'b').zfill(m))))
	x = u
	y = 0
	z = 0
	for b in range(m - 1):
		d = 1 << b
		if r_bits[b + 1]:
			if x & d:
				y += d
				z += d
			else:
				x += d
				y += d
	out = []
	if x:
		out.append(x)
	if y:
		out.append(y)
	if z:
		out.append(z)
	print(len(out))
	if out:
		print(*out)
xorcise(u, v)


(u, v) = map(int, input().split())
kouho = [u]
k = v - u
if k < 0 or k % 2 != 0:
	if u == v:
		print(1)
		print(u)
	else:
		print(-1)
	exit()
k //= 2
kouho.append(k)
kouho.append(k)
if kouho[1] == 0:
	if u == 0:
		print(0)
	else:
		print(1)
		print(u)
elif kouho[0] ^ kouho[1] == kouho[0] + kouho[1]:
	print(2)
	print(kouho[0] + kouho[1], kouho[2])
else:
	print(3)
	print(kouho[0], kouho[1], kouho[2])


(x, s) = map(int, input().split())
if x > s:
	print(-1)
	exit(0)
if x == s == 0:
	print(0)
	exit(0)
if x == s:
	print(1)
	print(x)
	exit(0)
if x == 0 and s % 2 == 1:
	print(-1)
	exit(0)
elif x == 0:
	print(2)
	print(s // 2, s // 2)
	exit(0)
if (s + x) % 2 == 1:
	print(-1)
	exit(0)
lol = (s - x) // 2
if lol ^ s - lol == x:
	print(2)
	print(lol, s - lol)
	exit(0)
print(3)
print(lol, lol, x)


import math
(u, v) = map(int, input().split())
if v != 0:
	k = math.ceil(math.log2(v))
if u == 0 and v == 0:
	print(0)
	exit(0)
if u == v:
	print(1)
	print(v)
	exit(0)
if u > v or (u ^ v) & 1 == 1:
	print(-1)
else:
	carry = 0
	able = True
	a = b = 0
	for i in range(k + 1):
		xor = u >> i & 1
		sum = v >> i & 1
		if carry == 0:
			if sum ^ xor == 1:
				able = False
				break
			elif sum == 1:
				a = a | 1 << i
				b = b & ~(1 << i)
			else:
				carry = 1
		elif carry == 2:
			if sum ^ xor == 0:
				able = False
				break
			elif xor == 1:
				a = a | 1 << i
				b = b & ~(1 << i)
				carry = 2
			else:
				carry = 1
		else:
			if xor ^ sum == 0:
				a = a & ~(1 << i - 1)
				b = b & ~(1 << i - 1)
			else:
				a = a | 1 << i - 1
				b = b | 1 << i - 1
			if xor == 1:
				a = a | 1 << i
				b = b & ~(1 << i)
				if sum == 0:
					carry = 2
				else:
					carry = 0
			else:
				carry = 1
	if able == True:
		print(2)
		print('%d %d' % (a, b))
	else:
		v = v - u
		for i in range(k):
			if v >> i + 1 & 1 == 1:
				v = v | 1 << i
			elif v >> i & 1 == 1:
				v = v ^ 1 << i
		print(3)
		print(' '.join((str(i) for i in (u, v, v))))


(u, v) = [int(x) for x in input().split()]
if u > v or (v - u) % 2 == 1:
	print(-1)
elif u == v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
else:
	(a, b) = (u | (v - u) // 2, (v - u) // 2)
	if a ^ b == u and a + b == v:
		print(2)
		print(a, b)
	else:
		print(3)
		print((v - u) // 2, (v - u) // 2, u)


from collections import Counter
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(x, s) = gil()
if x > s or s - x & 1:
	print(-1)
else:
	d = (s - x) // 2
	a = [x, d, d]
	for i in range(1, 3):
		for j in range(60):
			bit = 1 << j
			if a[i] & bit and a[i - 1] & bit == 0:
				a[i] = a[i] ^ bit
				a[i - 1] = a[i - 1] ^ bit
	while a and a[-1] == 0:
		a.pop()
	print(len(a))
	if a:
		print(*a)


(u, v) = map(int, input().split())
if u > v:
	print(-1)
elif u == v and u == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
elif u % 2 == 0 and v % 2 != 0 or (u % 2 != 0 and v % 2 == 0):
	print(-1)
elif u == 1:
	print(v)
	for i in range(v):
		print(1, end=' ')
	print()
else:
	a = (v - u) // 2
	b = (v - u) // 2 + u
	if a ^ b == u:
		print(2)
		print(a, b)
	else:
		print(3)
		print(u, a, a)


(u, v) = map(int, input().split())

def sameforbin(a, b):
	aa = bin(a)[2:]
	bb = bin(b)[2:]
	for i in range(1, min(len(aa), len(bb)) + 1):
		if aa[-i] == bb[-i] == '1':
			return True
	return False
if u > v or (v - u) % 2:
	print(-1)
elif u == v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
else:
	d = (v - u) // 2
	if sameforbin(d, u):
		print(3)
		print(d, d, u)
	else:
		print(2)
		print(d, u + d)


from math import *
from operator import *
import sys, random

def nextInt():
	return int(input())

def nextStrs():
	return input().split()

def nextInts():
	return list(map(int, nextStrs()))

def main():
	t = 1
	for _ in range(t):
		(u, v) = nextInts()
		if u > v:
			print(-1)
		elif u == v:
			print('0' if u == 0 else f'1\n{u}')
		elif u % 2 != v % 2:
			print(-1)
		else:
			div = (v - u) // 2
			if xor(u, div) == div + u:
				print(f'2\n{u + div} {div}')
			else:
				print(f'3\n{u} {div} {div}')
exit(main())


def main():
	(u, v) = map(int, input().split())
	dif = v - u
	if dif < 0 or dif % 2:
		print(-1)
		return
	elif dif == 0 and u == 0:
		print(0)
		return
	elif dif == 0:
		ans = [u]
	else:
		half = dif >> 1
		rest = v - 2 * half
		if rest & half:
			ans = [half, half, rest]
		else:
			ans = [half, half + rest]
	print(len(ans))
	print(*ans)
	return
main()


(u, v) = map(int, input().split())
if u == v == 0:
	print(0)
	exit()
if u == v:
	print(1)
	print(u)
	exit()
if u > v:
	print(-1)
	exit()
a = (v - u) // 2
b = v - a
if a ^ b == u:
	print(2)
	print(a, b)
	exit()
if (v - u) % 2 == 0:
	print(3)
	print(u, (v - u) // 2, (v - u) // 2)
else:
	print(-1)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(x, y):
	return f(x) // (f(y) * f(x - y))
(u, v) = map(int, input().split())
if v < u:
	print(-1)
	exit()
if v == u == 0:
	print(0)
	exit()
if v == u:
	print(1)
	print(u)
	exit()
if (v - u) % 2 != 0:
	print(-1)
	exit()
x = (v - u) // 2
if x & u != 0:
	print(3)
	print(u, x, x)
	exit()
print(2)
print(u + x, x)


from sys import exit
(v, u) = map(int, input().split())
arr = []
for i in range(64):
	if v >> i & 1:
		arr.append(1 << i)
x = u - v
if x < 0 or x % 2 != 0:
	print(-1)
	exit(0)
for i in range(64):
	if x >> i & 1:
		arr.append(1 << i - 1)
		arr.append(1 << i - 1)
for i in range(len(arr)):
	for b in range(0, 64):
		if arr[i] >> b & 1 == 0:
			continue
		for j in range(i + 1, len(arr)):
			if arr[j] >> b & 1 == 1:
				continue
			arr[j] |= 1 << b
			arr[i] &= ~(1 << b)
			break
brr = []
for el in arr:
	if el == 0:
		continue
	brr.append(el)
print(len(brr))
print(*brr)


[u, v] = list(map(int, input().split(' ')))
if u == 0 and v == 0:
	print(0)
elif u > v or u % 2 != v % 2:
	print(-1)
elif u == v:
	print(1)
	print(v)
else:
	t = (v - u) // 2
	if t & u:
		print(3)
		print(str(t) + ' ' + str(t) + ' ' + str(u))
	else:
		print(2)
		print(str(t) + ' ' + str(t ^ u))


(u, v) = map(int, input().split())
if u > v:
	print(-1)
	exit(0)
if u == 0 and v == 0:
	print(0)
	exit(0)
if u == v:
	print(1)
	print(u)
	exit(0)
binary = [2 ** i for i in range(61)]
p = [0] * 60
d = v - u
v1 = v - u
u1 = u
for i in range(60 - 1, -1, -1):
	p[i] += u1 // binary[i]
	u1 %= binary[i]
answer = []
for i in range(60 - 1, 0, -1):
	if v1 >= binary[i]:
		p[i - 1] += 2
		v1 %= binary[i]
f = True
if p[0] % 2 == 1 and d % 2 == 1:
	print(-1)
	exit(0)
m = max(p)
while f:
	f = False
	k = 0
	for i in range(60 - 1, -1, -1):
		if p[i] > 0:
			f = True
			p[i] -= 1
			k += binary[i]
	if f:
		answer.append(k)
if sum(answer) != v:
	print(-1)
else:
	print(m)
	print(*answer)


import math
import fractions

def make_divisors(n):
	divisors = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n // i)
	return divisors

def ValueToBits(x, digit):
	res = [0 for i in range(digit)]
	now = x
	for i in range(digit):
		res[i] = now % 2
		now = now >> 1
	return res

def BitsToValue(arr):
	n = len(arr)
	ans = 0
	for i in range(n):
		ans += arr[i] * 2 ** i
	return ans

def ValueToArray10(x, digit):
	ans = [0 for i in range(digit)]
	now = x
	for i in range(digit):
		ans[digit - i - 1] = now % 10
		now = now // 10
	return ans
(a, b) = list(map(int, input().split()))
if (b - a) % 2 == 1 or a > b:
	print(-1)
	exit()
if a == b and a == 0:
	print(0)
	exit()
if a == b:
	print(1)
	print(a)
	exit()
dif = (b - a) // 2
aa = ValueToBits(a, 60)
difs = ValueToBits(dif, 60)
for i in range(60):
	if aa[i] + difs[i] == 2:
		print(3)
		print(a, dif, dif)
		exit()
print(2)
print(a + dif, dif)


(u, v) = list(map(int, input().split()))
if u > v:
	print(-1)
elif u == 0 and v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
else:
	(a, b, c) = (u, (v - u) // 2, (v - u) // 2)
	(d, e) = ((v - u) // 2 + u, (v - u) // 2)
	if d + e == v and d ^ e == u:
		print(2)
		print(d, e)
	elif a + b + c == v and a ^ b ^ c == u:
		print(3)
		print(a, b, c)
	else:
		print(-1)


(u, v) = list(map(int, input().split()))
mas = []
if v < u - 1:
	print(-1)
	exit()
if u % 2 != v % 2:
	print(-1)
	exit()
if u == 0 and v == 0:
	print(0)
	exit()
if u == v:
	print(1)
	print(u)
	exit()
x = (v - u) // 2
if u & x:
	print(3)
	print(u, x, x, sep=' ')
	exit()
print(2)
print(u + x, x, sep=' ')


import sys
readline = sys.stdin.readline
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))

def solve():
	(u, v) = nm()
	if u == v:
		if u == 0:
			print(0)
		else:
			print(1)
			print(u)
		return
	elif u > v:
		print(-1)
		return
	w = v - u
	if w & 1:
		print(-1)
	else:
		l = [u, w // 2, w // 2]
		if not l[0] & l[-1]:
			l[0] ^= l.pop()
		print(len(l))
		print(*l)
	return
solve()


(m, n) = [int(i) for i in input().split()]
if m > n or (n - m) % 2 != 0:
	print(-1)
else:
	rz2 = (n - m) // 2
	rz3 = rz2
	if n == 0:
		print(0)
	elif n == m:
		print(1)
		print(n)
	elif m ^ rz2 ^ rz3 == m + rz2 ^ rz3:
		print(2)
		print(m + rz2, rz3)
	else:
		print(3)
		print(m, rz2, rz3)


import math
(a, b) = map(int, input().split())
if a == b:
	if a == 0:
		print(0)
	else:
		print(1)
		print(a)
elif a > b:
	print(-1)
elif a == 0:
	if b % 2 == 0:
		print(2)
		print(b // 2, b // 2)
	else:
		print(-1)
elif (b - a) % 2 == 0:
	if int((b - a) // 2) ^ int((b + a) // 2) == a:
		print(2)
		print((b - a) // 2, (b + a) // 2)
	else:
		print(3)
		print(a, (b - a) // 2, (b - a) // 2)
else:
	print(-1)


import sys
input = sys.stdin.readline
(u, v) = map(int, input().split())
if u > v:
	print(-1)
elif (v - u) % 2 == 1:
	print(-1)
elif u == v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
else:
	A = (v - u) // 2
	B = (v - u) // 2
	REST = u
	for i in range(64):
		if REST & 1 << i != 0 and A & 1 << i == 0:
			A += 1 << i
			REST -= 1 << i
	if REST == 0:
		print(2)
		print(A, B)
	else:
		print(3)
		print(A, B, REST)


import bisect, collections

def solution():
	(u, v) = [int(x) for x in input().strip().split(' ')]
	if u == v:
		if u == 0:
			print(0)
		else:
			print(1)
			print(u)
	elif u > v or (v - u) % 2 == 1:
		print(-1)
	else:
		k = (v - u) // 2
		if k & u == 0:
			print(2)
			print(k | u, k)
		else:
			print(3)
			print(u, k, k)

def main():
	for _ in range(1):
		solution()
main()


from math import ceil

def findpow2(integer):
	pow2 = 1
	while pow2 <= integer:
		pow2 *= 2
	return pow2
(U, V) = list(map(int, input().split()))
carry = V - U
if carry < 0 or carry % 2 == 1:
	print(-1)
elif V == 0:
	print(0)
elif carry == 0:
	print(1)
	print(U)
else:
	B = carry // 2
	if U + B ^ B == U:
		nums = (U + B, B)
	else:
		nums = (U, B, B)
	qty = len(nums)
	nums = ' '.join(list(map(str, nums)))
	print(qty)
	print(nums)


from sys import stdin
input = stdin.readline
import math
(u, v) = map(int, input().split())
if u == v:
	if u == 0:
		print(0)
		return
	print(1)
	print(u)
	return
if u > v:
	print('-1')
	return
if (v - u) % 2:
	print('-1')
	return
p = (v - u) // 2
if u & p == 0:
	print(2)
	print(p, u + p, sep=' ')
	return
print(3)
print(u, p, p, sep=' ')


def compute(y, x):
	A = (y - x) // 2
	a = 0
	b = 0
	for i in range(64):
		Xi = x & 1 << i
		Ai = A & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			return [False, 0, 0]
	return [True, a, b]
(u, v) = map(int, input().split())
if u == 0 and v == 0:
	print(0)
elif u == 0 and v % 2 == 0:
	print(2)
	print(v // 2, v // 2)
elif u > v:
	print(-1)
elif u == v:
	print(1)
	print(u)
else:
	if u % 2 != v % 2:
		print(-1)
		exit()
	ans = compute(v, u)
	if ans[0] == True and ans[1] != 0 and (ans[2] != 0):
		print(2)
		print(ans[1], ans[2])
	else:
		print(3)
		print(u, (v - u) // 2, (v - u) // 2)


import sys
from array import array

def input():
	return sys.stdin.buffer.readline().decode('utf-8')
(u, v) = map(int, input().split())
if u > v or v - u & 1:
	print(-1)
	exit()
if u == v == 0:
	print(0)
	exit()
if u == v:
	print(f'1\n{u}')
	exit()
bit_and = v - u >> 1
if u & bit_and:
	print(f'3\n{bit_and} {bit_and} {u}')
else:
	print(f'2\n{bit_and} {bit_and | u}')


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def two(u, a):
	for k in range(70):
		if a >> k & 1 and u >> k & 1:
			return False
	return True

def main():
	(u, v) = MI()
	if u > v or v - u & 1:
		print(-1)
		exit()
	elif v == 0:
		print(0)
		exit()
	elif u == v:
		ans = [u]
	else:
		a = v - u >> 1
		if two(u, a):
			ans = [a, a | u]
		else:
			ans = [u, (v - u) // 2, (v - u) // 2]
	print(len(ans))
	print(*ans)
main()


import math
(u, v) = [int(x) for x in input().split()]
x = v - u
arr = []

def check(u, x):
	if u != 0:
		bits = int(math.log2(u))
	else:
		bits = 0
	for i in range(0, bits + 2):
		if 1 << i & u != 0:
			if 1 << i & x != 0:
				return False
	return True
if x < 0 or x % 2 == 1:
	print(-1)
else:
	if check(u, x // 2):
		u = u ^ x // 2
	else:
		arr.append(x // 2)
	if x // 2 != 0:
		arr.append(x // 2)
	if u != 0:
		arr.append(u)
	print(len(arr))
	for i in range(0, len(arr)):
		print(int(arr[i]), end=' ')


import sys
inp = sys.stdin.readline

def input():
	return inp().strip()

def iin():
	return int(input())

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

def main():
	T = 1
	while T:
		T -= 1
		(u, v) = lin()
		if u > v:
			print(-1)
		else:
			a = []
			ch = 0
			v -= u
			while u:
				if u & 1:
					a.append(1 << ch)
				ch += 1
				u >>= 1
			if v % 2 == 0:
				if v:
					a.append(v // 2)
					a.append(v // 2)
				chg = 1
				while chg:
					chg = 0
					l = len(a)
					na = []
					done = set()
					for i in range(l):
						if i in done:
							continue
						for j in range(i + 1, l):
							if j in done:
								continue
							elif a[i] & a[j] == 0:
								chg = 1
								na.append(a[i] + a[j])
								done.update([i, j])
								break
					for i in range(l):
						if i not in done:
							na.append(a[i])
					a = na
				print(len(a))
				print(*a)
			else:
				print(-1)
main()


def linput(a):
	return [int(i) for i in a.split()]
for ughblnk in range(1):
	(u, v) = linput(input())
	if u > v:
		print(-1)
	elif u % 2 != v % 2:
		print(-1)
	elif u == 0 and v == 0:
		print(0)
	elif u == v:
		print(1)
		print(u)
	else:
		t = (v - u) // 2
		if u + t ^ t != u:
			print(3)
			print(u, t, t)
		else:
			print(2)
			print(u + t, t)


from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush
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 RL():
	return map(int, sys.stdin.readline().rstrip().split())

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	(u, v) = RL()
	if u > v or u % 2 != v % 2:
		print(-1)
	elif u == v and u == 0:
		print(0)
	elif u == v:
		print(1)
		print(u)
	else:
		pa = (v - u) // 2
		arr = [u, pa, pa]
		if pa + u ^ pa == u:
			print(2)
			print(*[pa + u, pa])
		else:
			print(3)
			print(*arr)
main()


def main_function():
	(u, v) = list(map(int, input().split(' ')))
	if u > v or (v - u) % 2 == 1:
		print('-1')
	elif (v - u) % 2 == 0:
		sup_num = (v - u) // 2
		A = [sup_num, u + sup_num]
		if A[0] ^ A[1] == u:
			if A[0] != 0:
				print(2)
			else:
				print(1 if u != 0 else 0)
				A = [u] if u != 0 else []
			print(*A)
		else:
			print(3)
			print(sup_num, sup_num, u)
	else:
		print('ghost or phantom')
main_function()


def f(u, v):
	x = [int(y) for y in bin(u)[2:]]
	s = [int(z) for z in bin(v)[2:]]
	x = [0] * (len(s) - len(x)) + x
	a = [0] * len(x)
	b = [0] * len(x)
	for i in range(len(x) - 1, 0, -1):
		if x[i] == 1:
			a[i] = 0
			b[i] = 1
		elif s[i - 1] == x[i - 1]:
			a[i] = 0
			b[i] = 0
		else:
			a[i] = 1
			b[i] = 1
	if x[0] == 1:
		a[0] = 0
		b[0] = 1
	c = 0
	d = 0
	for i in range(len(a)):
		c += pow(2, len(a) - i - 1) * a[i]
		d += pow(2, len(a) - i - 1) * b[i]
	return (c, d)
(u, v) = map(int, input().split())
if u % 2 != v % 2 or v < u:
	print(-1)
elif u == 0 and v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
else:
	(c, d) = f(u, v)
	if c + d == v and c ^ d == u:
		print(2)
		print(c, d)
	else:
		print(3)
		print(u, (v - u) // 2, (v - u) // 2)


(u, v) = list(map(int, input().split()))
rem = v - u
out = [u]
if rem < 0:
	print(-1)
elif v == u == 0:
	print(0)
elif rem == 0:
	print(1)
	print(u)
elif rem % 2 == 0:
	add = rem // 2
	if add + u == add ^ u:
		print(2)
		print(add + u, add)
	else:
		print(3)
		print(u, add, add)
else:
	print(-1)


import io
import os
from collections import Counter, defaultdict, deque

def solve(U, V):
	if U == V == 0:
		return 0
	binU = [int(d) for d in bin(U)[2:]][::-1]
	binV = [int(d) for d in bin(V)[2:]][::-1]
	N = max(len(binU), len(binV))
	while len(binU) < N:
		binU.append(0)
	while len(binV) < N:
		binV.append(0)
	assert len(binU) == len(binV) == N
	ones = defaultdict(int)
	if binU[0] != binV[0]:
		return -1
	if binU[0] == 1:
		ones[0] += 1
	carries = ones[0] // 2
	for i in range(1, N):
		if ones[i] % 2 != binU[i]:
			ones[i] += 1
		if (ones[i] + carries) % 2 != binV[i]:
			ones[i - 1] += 2
			carries += 1
		if False:
			assert ones[i] % 2 == binU[i]
			assert (ones[i] + carries) % 2 == binV[i]
		carries = (ones[i] + carries) // 2
	if carries != 0:
		return -1
	outN = max(ones.values())
	arr = []
	for i in range(outN):
		temp = 0
		for j in range(N):
			if i < ones[j]:
				temp += 1 << j
		arr.append(temp)
	if False:
		check1 = 0
		check2 = 0
		for x in arr:
			check1 ^= x
			check2 += x
		assert check1 == U
		assert check2 == V
	return str(len(arr)) + '\n' + ' '.join(map(str, arr))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(U, V) = [int(x) for x in input().split()]
ans = solve(U, V)
print(ans)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def in_int():
	return int(input())

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

def in_str():
	s = input()
	return list(s[:len(s) - 1])

def in_ints():
	return map(int, input().split())
(xor, add) = in_ints()
import math
if xor > add:
	print(-1)
else:
	a = [0] * 100
	if (add - xor) % 2 == 1:
		print(-1)
	else:
		add = add - xor
		while xor > 0:
			a[int(math.log2(xor & -xor))] += 1
			xor -= xor & -xor
		while add > 0:
			p = int(math.log2(add & -add)) - 1
			add -= add & -add
			a[p] += 2
		n = max(a)
		ans = []
		print(n)
		p = 0
		ans = 0
		for i in range(n):
			xx = 0
			for j in range(len(a)):
				if a[j] > 0:
					a[j] -= 1
					xx += int(math.pow(2, j))
			p = p ^ xx
			ans += xx
			print(xx, end=' ')
		print()


def f(a):
	b = 0
	while a > 0:
		b += 1
		a //= 2
	return 2 ** (b - 1)
(u, v) = map(int, input().split())
if u > v:
	print(-1)
elif u == v == 0:
	print(0)
elif u == v:
	print(1)
	print(v)
else:
	k = 0
	while True:
		if u == 0:
			break
		c = f(u)
		u -= c
		v -= c
		k += c
	if v % 2 == 1:
		print(-1)
	elif k & v // 2 == 0:
		k += v // 2
		print(2)
		print(k, v // 2)
	else:
		print(3)
		print(k, v // 2, v // 2)


s = input().split()
u = int(s[0])
v = int(s[1])
if u > v or (u + v) % 2 == 1:
	print(-1)
elif u == v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
elif (u + v) % 2 == 0:
	if (v + u) // 2 ^ (v - u) // 2 == u:
		print(2)
		print((v + u) // 2, ' ', (v - u) // 2)
	else:
		print(3)
		print(u, ' ', (v - u) // 2, ' ', (v - u) // 2)


import sys

def go():
	(x, s) = map(int, input().split())
	if x > s:
		return -1
	if x == s == 0:
		return 0
	left = 0
	bits = []
	for b in range(s.bit_length() - 1, -1, -1):
		f = 1 << b
		curbit = 0
		left = left * 2 + ((s & f) >> b)
		cur = (x & f) >> b
		if cur > left:
			borrow = len(bits) - 1
			while borrow >= 0 and bits[borrow] < 2:
				borrow -= 1
			if borrow < 0:
				return -1
			bits[borrow] -= 2
			for bor in range(borrow + 1, len(bits)):
				bits[bor] += 2
			left += 4
		if cur == 1:
			cur -= 1
			left -= 1
			curbit = 1
		curbit += left - left % 2
		left = left % 2
		bits.append(curbit)
	if left:
		return -1
	vals = []
	for i in range(1, max(bits) + 1):
		v = 0
		for bb in bits:
			v = v * 2 + (bb >= i)
		vals.append(v)
	return str(len(vals)) + '\n' + ' '.join(map(str, vals))
t = 1
for _ in range(t):
	print(go())


import math
(x, s) = map(int, input().split())
if x > s:
	print(-1)
	exit
else:
	a = (s - x) // 2
	p = 0
	q = 0
	r = 0
	for i in range(60):
		if x & pow(2, i) != 0 and a & pow(2, i) == 0:
			p += pow(2, i)
		if x & pow(2, i) == 0 and a & pow(2, i) != 0:
			p += pow(2, i)
			q += pow(2, i)
		if x & pow(2, i) != 0 and a & pow(2, i) != 0:
			p += pow(2, i)
			q += pow(2, i)
			r += pow(2, i)
	v = []
	if p > 0:
		v.append(p)
	if q > 0:
		v.append(q)
	if r > 0:
		v.append(r)
	flag = 0
	if (s - x) % 2 == 1:
		z = s - (p + q + r)
		if z ^ p ^ q ^ r != x:
			flag = 1
		else:
			v.append(z)
	if flag == 1:
		print(-1)
	else:
		print(len(v))
		for i in v:
			print(i, end=' ')


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
from bisect import bisect, bisect_left
from time import time
from itertools import permutations as per
from heapq import heapify, heappush, heappushpop
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\r\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
nCr = lambda x, y: f[x] * inv(f[y] * f[x - y] % N) % N
inv = lambda x: pow(x, N - 2, N)
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
(n, k) = R()
if n > k or k - n & 1:
	print(-1)
elif n == k == 0:
	print(0)
elif n == k:
	print(1)
	print(k)
else:
	p = bin(n)[2:][::-1]
	q = bin((k - n) // 2)[2:][::-1]
	m = 0
	for i in range(min(len(p), len(q))):
		if p[i] == q[i] == '1':
			m = 1
			break
	if m and n:
		print(3)
		print(n, (k - n) // 2, (k - n) // 2)
	else:
		print(2)
		print(n + (k - n) // 2, (k - n) // 2)


inp = input().split(' ')
u = int(inp[0])
v = int(inp[1])
if u > v or u % 2 != v % 2:
	print(-1)
elif (u, v) == (0, 0):
	print(0)
elif u == v:
	print(1)
	print(u)
else:
	x = int((v - u) // 2)
	if x & u:
		print(3)
		print(u, x, x)
	else:
		print(2)
		print(u ^ x, x)


(U, V) = map(int, input().split())
if U > V or U % 2 != V % 2:
	print(-1)
elif U == V:
	if U == 0:
		print(0)
	else:
		print(1)
		print(U)
else:
	x = (V - U) // 2
	if x & U == 0:
		print(2)
		print(U + x, x)
	else:
		print(3)
		print(U, x, x)


from sys import stdin, stdout
(u, v) = map(int, stdin.readline().split())
if u > v:
	print('-1')
elif u % 2 != v % 2:
	print('-1')
elif u == 0 and v == 0:
	print('0')
elif u == 0:
	print(2)
	print(v // 2, v // 2)
elif u == v:
	print(1)
	print(u)
else:
	t = (v - u) // 2
	if t & u != 0:
		print(3)
		print(u, t, t)
	else:
		print(2)
		print(u + t, t)


import sys
input = sys.stdin.readline
from math import *
(k, m) = map(int, input().split())
if k > m:
	print(-1)
	exit(0)
r = list(bin(k))[2:]
n = len(r)
for i in range(n):
	if r[i] == '1':
		m -= 2 ** (n - i - 1)
if m & 1:
	print(-1)
	exit(0)
l = list(bin(m // 2))[2:]
f = [0 for i in range(60)]
for i in range(len(l)):
	if l[i] == '1':
		f[len(l) - i - 1] += 2
for i in range(len(r)):
	if r[i] == '1':
		f[len(r) - i - 1] += 1
d = []
while f.count(0) != len(f):
	g = 0
	for i in range(60):
		if f[i] > 0:
			f[i] -= 1
			g += 2 ** i
	d.append(g)
print(len(d))
print(*d)


(u, v) = map(int, input().split())
if u == v and u == 0:
	print(0)
elif v < u or (v - u) % 2 == 1:
	print(-1)
elif u == v:
	print(1)
	print(u)
else:
	ub = []
	a1 = u
	while u > 0:
		ub.append(u % 2)
		u = u // 2
	vb = []
	v = (v - a1) // 2
	a2 = v
	while v > 0:
		vb.append(v % 2)
		v = v // 2
	flag = 0
	for i in range(min(len(ub), len(vb))):
		if ub[i] == vb[i] and ub[i] == 1:
			flag = 1
			break
	if flag == 1:
		print(3)
		print(a1, a2, a2)
	else:
		print(2)
		print(a1 + a2, a2)


import sys
input = lambda : sys.stdin.readline().rstrip()
(u, v) = map(int, input().split())
if u == 0 and v == 0:
	print(0)
elif v < u or (v - u) % 2 == 1:
	print(-1)
elif u == v:
	print(1)
	print(u)
else:
	Ans = [u, (v - u) // 2, (v - u) // 2]
	if Ans[0] + Ans[1] == Ans[0] | Ans[1]:
		Ans = [Ans[0] + Ans[1], Ans[2]]
	print(len(Ans))
	print(*Ans)


(xor, add) = map(int, input().split())
if add < xor:
	print(-1)
elif add == xor and add == 0:
	print(0)
elif add == xor:
	print(1)
	print(xor)
elif (add - xor) % 2 != 0:
	print(-1)
else:
	div = (add - xor) // 2
	if div & xor == 0:
		print(2)
		print(xor + div, div)
	else:
		print(3)
		print(xor, div, div)


def compute(S, X):
	A = (S - X) // 2
	a = 0
	b = 0
	for i in range(64):
		Xi = X & 1 << i
		Ai = A & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			return -1
	if a + b != S:
		return -1
	return (a, b)
(a, b) = list(map(int, input().strip().split()))
if a == b == 0:
	print(0)
	exit()
if a == b:
	print(1)
	print(a)
	exit()
if (b - a) % 2 != 0:
	print(-1)
	exit()
o = compute(b, a)
if o != -1:
	print(2)
	print(*o)
	exit()
v = (b - a) // 2
if v < 0:
	print(-1)
	exit()
print(3)
print(a, v, v)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
(u, v) = list(map(int, input().split()))
if u > v:
	print(-1)
elif u == v:
	if u == 0:
		print(0)
	else:
		print(1)
		print(u)
elif u % 2 == 0:
	if v % 2 == 0:
		num = (v - u) // 2
		num2 = int(num & u)
		if not num2:
			print(2)
			print(str(u + num) + ' ' + str(num))
		else:
			print(3)
			print(str(u) + ' ' + str(num) + ' ' + str(num))
	else:
		print(-1)
elif v % 2 == 0:
	print(-1)
else:
	num = (v - u) // 2
	num2 = int(num & u)
	if not num2:
		print(2)
		print(str(u + num) + ' ' + str(num))
	else:
		print(3)
		print(str(u) + ' ' + str(num) + ' ' + str(num))


(x, s) = map(int, input().split())

def func(x, s):
	if s < x or abs((s - x) % 2) == 1:
		return [-1]
	elif s == x:
		return [s]
	else:
		andd = (s - x) // 2
		a = 0
		b = 0
		c = 0
		for i in range(64):
			xi = x & 1 << i
			ai = andd & 1 << i
			if xi == 0 and ai == 0:
				pass
			elif xi == 0 and ai > 0:
				a = 1 << i | a
				b = 1 << i | b
			elif xi > 0 and ai == 0:
				a = 1 << i | a
			else:
				c = 1 << i | c
		if c > 0:
			x = x ^ c
			s = s - c
			d = []
			d.extend(func(x, s))
			d.append(c)
			return d
		else:
			return [a, b]
a = func(x, s)
ok = 0
for i in a:
	if i == -1:
		print(-1)
		ok = 1
if ok == 0:
	if x == 0 and s == 0:
		print(0)
	else:
		print(len(a))
		for i in a:
			print(i, end=' ')


def compute(S, X):
	A = (S - X) // 2
	a = 0
	b = 0
	if (S - X) % 2 != 0:
		return -1
	for i in range(64):
		Xi = X & 1 << i
		Ai = A & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			return -1
	return (a, b)
(x, s) = list(map(int, input().split()))
ans = compute(s, x)
if ans != -1:
	if ans[0] == 0 and ans[1] == 0:
		print(0)
	elif ans[1] == 0:
		print(1)
		print(ans[0])
	else:
		print(2)
		print(ans[0], ans[1])
elif x == 0 or x > s:
	print(-1)
elif s % x == 0 and s // x % 2 != 0:
	print(s // x)
	print(*[x] * (s // x))
elif (s - x) % 2 == 0:
	print(3)
	print(x, (s - x) // 2, (s - x) // 2)
else:
	print(-1)


I = input
(a, b) = [*map(int, I().split())]
if a > b:
	print(-1)
elif b == a:
	if a == 0:
		print(0)
	else:
		print(1, a, sep='\n')
elif b - a & 1 == 1:
	print(-1)
else:
	x = int((b - a) // 2)
	if a + x ^ x == a:
		print('2')
		print(a + x, x)
	else:
		print(3)
		print(a, x, x)


(u, v) = map(int, input().split())
if v < u or (v - u) % 2 != 0:
	print(-1)
elif u == v:
	if u == 0:
		print(0)
	else:
		print('1\n' + str(u))
else:
	w = (v - u) // 2
	if w | u == w + u:
		print('2\n' + str(w | u) + ' ' + str(w))
	else:
		print('3\n' + str(u) + ' ' + str(w) + ' ' + str(w))


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

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

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

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
(u, v) = inputnums()
if u == v:
	if not u:
		print(0)
	else:
		print(1)
		print(u)
elif u % 2 != v % 2 or u > v:
	print(-1)
else:
	x = (v - u) // 2
	if u & x:
		print(3)
		print(u, x, x)
	else:
		print(2)
		print(u + x, x)


(u, v) = map(int, input().split())
if u > v or u % 2 != v % 2:
	print(-1)
	exit()
if u == v:
	if u == 0:
		print(0)
		exit()
	else:
		print(1)
		print(u)
		exit()
x = (v - u) // 2
if x & u:
	print(3)
	print(u, x, x)
else:
	print(2)
	print(u + x, x)


from sys import stdin
(u, v) = map(int, stdin.readline().split())
if u > v or u % 2 != v % 2:
	print(-1)
elif u == v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
else:
	x = (v - u) // 2
	if u & x:
		print(3)
		print(u, x, x)
	else:
		print(2)
		print(u ^ x, x)


import sys
(u, v) = list(map(int, sys.stdin.readline().strip().split()))
w = v - u
if w % 2 == 1 or w < 0:
	print(-1)
elif w == 0:
	if u == 0:
		print(0)
	else:
		print(1)
		print(str(u))
else:
	w = w // 2
	if u & w == 0:
		print(2)
		print(str(u + w) + ' ' + str(w))
	else:
		print(3)
		print(str(u) + ' ' + str(w) + ' ' + str(w))


(x, s) = map(int, input().split())
if s == 0:
	print(0)
elif x > s or (s - x) % 2 == 1:
	print(-1)
elif x == 0:
	print(2)
	print(s // 2, s // 2)
elif x == s:
	print(1)
	print(s)
elif int('1' * (len(bin(x)) - 2), 2) ^ s - int('1' * (len(bin(x)) - 2), 2) == x and s - int('1' * (len(bin(x)) - 2), 2) >= 0:
	print(2)
	print(int('1' * (len(bin(x)) - 2), 2), s - int('1' * (len(bin(x)) - 2), 2))
elif (x ^ (s - x) // 2) + (s - x) // 2 == s:
	print(2)
	print((s - x) // 2, x ^ (s - x) // 2)
else:
	print(3)
	print((s - x) // 2, (s - x) // 2, x)


import sys

def fun(u, v):
	x = [0] * 64
	z = (v - u) // 2
	a = list(bin(u)[2:])
	aa = len(a)
	for i in range(aa):
		if a[aa - i - 1] == '1':
			x[i] += 1
	a = list(bin(z)[2:])
	aa = len(a)
	for i in range(aa):
		if a[aa - i - 1] == '1':
			x[i] += 2
	xxx = max(x)
	op = []
	for i in range(xxx):
		a = 0
		for j in range(64):
			if x[j]:
				x[j] -= 1
				a += 2 ** j
		op.append(a)
	print(len(op))
	print(*op)
(a, b) = list(map(int, sys.stdin.readline().strip().split()))
(u, v) = (a, b)
if a > b:
	print(-1)
elif u % 2 == 1:
	if v % 2 == 1:
		fun(u, v)
	else:
		print(-1)
elif v % 2 == 0:
	fun(u, v)
else:
	print(-1)


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict
import bisect
import heapq as hq

def main():
	try:
		(u, v) = map(int, input().split())
		if u == 0 and v == 0:
			print(0)
			exit()
		if u % 2 != v % 2 or u > v:
			print(-1)
			exit(0)
		if u == v:
			print(1)
			print(v)
			exit()
		x = (v - u) // 2
		y = x ^ u
		if x + y == v:
			print(2)
			print(x, y)
		else:
			print(3)
			print(u, x, x)
	except:
		pass
M = 998244353
P = 1000000007
main()


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
(u, v) = read_int_line()
if u > v or u % 2 != v % 2:
	print(-1)
elif u == v and v != 0:
	print(1)
	print(u)
elif u == v:
	print(0)
elif (v - u) // 2 ^ (v + u) // 2 == u:
	print(2)
	print(*[(v - u) // 2, (v + u) // 2])
else:
	print(3)
	print(*[(v - u) // 2, (v - u) // 2, u])


powers = [2 ** i for i in range(61)]
(x, s) = map(int, input().split())
if x > s:
	print(-1)
elif x == s:
	if x == 0:
		print(0)
	else:
		print(1)
		print(x)
else:
	bckt = [0] * 3
	bckt[0] = x
	s -= x
	i = 0
	bad = set()
	good = set()
	while i < 61:
		query = x >> i
		if query % 2:
			bad.add(i)
		else:
			good.add(i)
		i += 1
	while s > 1:
		to_add = 1
		for i in range(61):
			if powers[i] <= s // 2:
				to_add = i
		s -= 2 * powers[to_add]
		if to_add in bad:
			bckt[1] += powers[to_add]
			bckt[2] += powers[to_add]
		elif to_add in good:
			bckt[0] += powers[to_add]
			bckt[1] += powers[to_add]
	if s % 2:
		print(-1)
	elif 0 in bckt:
		to_print = [i for i in bckt if i > 0]
		print(len(to_print))
		print(*to_print)
	else:
		print(3)
		print(*bckt)


(xor, summ) = map(int, input().split())
if xor > summ or xor & 1 != summ & 1:
	print(-1)
else:
	temp = (summ - xor) // 2
	if temp != 0:
		if xor & temp:
			print(3)
			print(xor, temp, temp)
		else:
			print(2)
			print(temp + xor, temp)
	elif xor == 0 and summ == 0:
		print(0)
	else:
		print(1)
		print(xor)


import sys
input = sys.stdin.readline
(x, s) = [int(x) for x in input().split()]
if x > s or x % 2 != s % 2:
	print(-1)
	exit()
elif x == s:
	if x == 0:
		print(0)
	else:
		print(1)
		print(x)
	exit()
(ans1, ans2) = (0, 0)
a = (s - x) // 2
if a & x:
	print(3)
	print(x, a, a)
else:
	print(2)
	print(x ^ a, a)


import sys

def compute(S, X):
	A = (S - X) // 2
	a = 0
	b = 0
	for i in range(64):
		Xi = X & 1 << i
		Ai = A & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			return [-1, -1]
	return [a, b]
(Xor, Sum) = map(int, sys.stdin.readline().split())
if Xor > Sum or Xor % 2 != Sum % 2:
	print(-1)
elif Xor == Sum:
	if Sum != 0:
		print(1)
	print(Xor)
else:
	p = compute(Sum, Xor)
	if p[0] > 0 and p[1] > 0:
		print(2)
		print(p[0], p[1])
	else:
		print(3)
		print(Xor, (Sum - Xor) // 2, (Sum - Xor) // 2)


(u, v) = map(int, input().split())
if u > v or (v - u) % 2 == 1:
	print(-1)
	return
v = (v - u) // 2
a = u | v
b = v
c = u & v
if a == 0:
	print(0)
elif b == 0:
	print(1)
	print(a)
elif c == 0:
	print(2)
	print(a, b)
else:
	print(3)
	print(a, b, c)


from math import *
from collections import *
from operator import itemgetter
import bisect
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
I = lambda : list(map(int, input().split()))
chrIdx = lambda x: ord(x) - 96
idxChr = lambda x: chr(96 + x)
(u, v) = iia()
if u == 0 and v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
elif (v - u) % 2 == 1 or u > v:
	print(-1)
else:
	a = [u, (v - u) // 2, (v - u) // 2]
	if u ^ (v - u) // 2 == u + (v - u) // 2:
		a = [u + (v - u) // 2, (v - u) // 2]
	print(len(a))
	print(*a)


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():
	(u, v) = map(int, input().split())
	if u > v:
		print(-1)
		return
	if u % 2 != v % 2:
		print(-1)
		return
	if v == 0:
		print(0)
		return
	if u == v:
		print(1)
		print(u)
		return
	x = (v - u) // 2
	if x & u == 0:
		print(2)
		print(x | u, x)
	else:
		print(3)
		print(u, x, x)
main()


(u, v) = [int(x) for x in input().split()]
if u > v or u % 2 != v % 2:
	print(-1)
elif u == v:
	if not u:
		print(0)
	else:
		print(1)
		print(u)
else:
	x = (v - u) // 2
	if u & x > 0:
		print(3)
		print(x, x, u)
	else:
		print(2)
		print(x + u, x)


def ii():
	return int(input())

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

def ai():
	return list(map(int, input().split()))
(u, v) = mi()
if u > v or u & 1 != v & 1:
	print(-1)
elif u == 0 and v == 0:
	print(0)
else:
	x = (v - u) // 2
	if x:
		if u & x != 0:
			print(3)
			print(u, x, x)
		else:
			print(2)
			print(u + x, x)
	else:
		print(1)
		print(u)


(u, v) = map(int, input().split())
if (u - v) % 2 != 0 or u > v:
	print(-1)
elif u == 0 == v:
	print(0)
elif u == v:
	print(1)
	print(u)
else:
	U = u
	V = v
	u = bin(u)[2:]
	v = bin(v)[2:]
	u = '0' * (70 - len(u)) + u
	v = '0' * (70 - len(v)) + v
	A = [0] * 70
	b = True
	for i in range(70):
		if u[i] == '0' and v[i] == '0':
			continue
		if u[i] == '0' and v[i] == '1':
			if i == 69:
				print(-1)
				exit(0)
			A[i + 1] += 2
		if u[i] == '1' and v[i] == '1':
			A[i] += 1
		if u[i] == '1' and v[i] == '0':
			if i == 69:
				b = False
			flag = False
			for j in range(i, -1, -1):
				if A[j] == 0:
					A[j] = 2
				elif A[j] == 1:
					break
				else:
					A[j] -= 2
					flag = True
					break
			if not flag:
				b = False
			A[i] += 1
			A[i + 1] = 2
			continue
	if max(A) >= 3 or not b:
		print(3)
		print((V - U) // 2, (V - U) // 2, U)
		exit(0)
	print(max(A))
	for i in range(1, 1 + max(A)):
		num = 0
		for j in range(1, 70):
			if A[-j] >= i:
				num += 2 ** (j - 1)
		print(num, end=' ')


def solve(x, s):
	a = (s - x) // 2
	(aa, bb) = (0, 0)
	for i in range(0, 64):
		ai = 1 << i & a
		xi = 1 << i & x
		if ai == 0 and xi == 0:
			pass
		elif ai > 0 and xi == 0:
			aa = 1 << i | aa
			bb = 1 << i | bb
		elif ai == 0 and xi > 0:
			aa = 1 << i | aa
		else:
			return [x, a, a]
	return [aa, bb]
(x, s) = map(int, input().split())
if x == s == 0:
	print(0)
elif x == s:
	print(1)
	print(x)
elif x > s or (s - x) % 2:
	print(-1)
else:
	ans = solve(x, s)
	print(len(ans))
	print(*ans)


(x, s) = map(int, input().split())
t = (s - x) // 2
a = 0
b = 0
f = 0
if x > int(s) or int(x) % 2 != int(s) % 2:
	print(-1)
elif int(x) == 0 and int(s) == 0:
	print(0)
elif x == s:
	print(1)
	print(x)
else:
	for i in range(64):
		y = x & 1 << i
		z = t & 1 << i
		if y == 0 and z == 0:
			continue
		elif y == 0 and z > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif y > 0 and z == 0:
			a = 1 << i | a
		else:
			f = 1
			break
	if f == 0:
		print(2)
		print(a, b)
	else:
		print(3)
		print(int(x), t, t)


def main():
	import sys
	input = sys.stdin.buffer.readline
	(u, v) = map(int, input().split())
	if u > v:
		print(-1)
		exit()
	if u & 1 != v & 1:
		print(-1)
		exit()
	if u == v == 0:
		print(0)
		exit()
	a = 0
	b = 0
	w = v - u >> 1
	for i in range(100):
		if w >> i & 1:
			if u >> i & 1:
				a ^= 1 << i
				b ^= 1 << i
			else:
				a ^= 1 << i
				u ^= 1 << i
	ans = [u]
	if a:
		ans.append(a)
	if b:
		ans.append(b)
	print(len(ans))
	print(*ans)
main()


for _ in range(1):
	(u, v) = map(int, input().split())
	if u == v and u + v != 0:
		print(1)
		print(u)
	elif v < u:
		print(-1)
	elif (v - u) % 2 == 1:
		print(-1)
	elif u + v == 0:
		print(0)
	else:
		z = v - u
		if z // 2 + u ^ z // 2 == u:
			print(2)
			print(z // 2 + u, z // 2)
		else:
			print(3)
			print(z // 2, z // 2, u)


from math import log, ceil
(x, y) = map(int, input().split())
bi = bin(x)
s = []
k = y
(ans, ans2) = ([], [])
for i in range(len(bi) - 1, 1, -1):
	s.append(int(bi[i]))
for i in range(65):
	s.append(0)
if y > 0:
	for i in range(ceil(log(y, 2)) + 1, -1, -1):
		if s[i] == 1:
			k -= 2 ** i
			ans.append(1)
			ans2.append(0)
		elif k >= 2 ** (i + 1):
			k -= 2 ** (i + 1)
			ans.append(1)
			ans2.append(1)
		else:
			ans.append(0)
			ans2.append(0)
if x % 2 != y % 2 or x > y:
	print(-1)
elif x == y == 0:
	print(0)
elif x == y:
	print(1)
	print(x)
elif x == 0:
	print(2)
	print(y // 2, y // 2)
elif k == 0:
	print(2)
	ans.reverse()
	ans2.reverse()
	(a, b) = (0, 0)
	for i in range(len(ans)):
		a += ans[i] * 2 ** i
	for i in range(len(ans)):
		b += ans2[i] * 2 ** i
	print(a, b)
else:
	print(3)
	print(x, (y - x) // 2, (y - x) // 2)


from functools import reduce

def to_bits(x):
	bits = [0] * 64
	for i in range(64):
		bits[i] = x & 1
		x >>= 1
	return bits
(u, v) = map(int, input().split())
bu = to_bits(u)
bv = to_bits(v)
cnt = [0] * 64
if bu[0] != bv[0] or u > v:
	print(-1)
	exit()
act = 0
cnt[0] = bu[0]
for i in range(1, 64):
	act //= 2
	cnt[i] = bu[i]
	bv[i] ^= act
	if bu[i] != bv[i]:
		cnt[i - 1] += 2
		act += 1
	act += cnt[i]
ans = max(cnt)
arr = [0] * ans
msk = 1
for i in range(64):
	for j in range(cnt[i]):
		arr[j] += msk
	msk <<= 1
print(ans)
print(*arr)


(u, v) = map(int, input().split())
if u > v:
	print(-1)
elif u == v:
	if u == 0:
		print(0)
	else:
		print(1)
		print(u)
else:
	dif = v - u
	if dif % 2 == 0:
		ha = dif // 2
		tr = ha + u
		if ha ^ tr == u:
			print(2)
			print(tr, ha)
		else:
			print(3)
			print(ha, ha, u)
	else:
		print(-1)


def pr1(a):
	print(a)
	exit()
flag = [0] * 100
(u, v) = map(int, input().split())
if u <= v:
	if v == 0:
		pr1(0)
	if v == u:
		print(1)
		print(v)
		exit()
	if (v - u) % 2 == 1:
		pr1(-1)
	fl = True
	for i in range(70):
		if v - u & 1 << i:
			flag[i - 1] += 1
			if u & 1 << i - 1:
				fl = False
	result = [u, 0]
	for i in range(70):
		if flag[i]:
			result[1] += 1 << i
	if fl:
		for i in range(70):
			if flag[i]:
				result[0] += 1 << i
	else:
		result.append(0)
		for i in range(70):
			if flag[i]:
				result[2] += 1 << i
	print(len(result))
	print(*result[::-1])
else:
	pr1(-1)


import os
import sys
from io import BytesIO, IOBase
import threading
from collections import Counter
mod = 998244353

def main():
	for _ in range(1):
		(x, s) = map(int, input().split())
		a = (s - x) // 2
		if (s - x) % 2 != 0 or s - x < 0:
			print(-1)
		elif s == x == 0:
			print(0)
		elif a & x != 0:
			print(3)
			print(x, a, a)
		elif s == x:
			print(1)
			print(s)
		else:
			print(2)
			print(a, a | x)
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')
main()


(u, v) = map(int, input().split())
if u > v or u % 2 != v % 2:
	print('-1')
elif u == v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
elif u & (v - u) // 2 is not 0:
	print(3)
	print(u, (v - u) // 2, (v - u) // 2)
else:
	print(2)
	print(u + (v - u) // 2, (v - u) // 2)


(x, s) = map(int, input().split())

def odw(l):
	wyn = 0
	pot = 1
	for i in l:
		wyn += pot * i
		pot *= 2
	return wyn

def konw(n):
	l = []
	while n > 0:
		l.append(n % 2)
		n //= 2
	return l
xx = konw(x)
ss = konw(s)
if x == 0 and s == 0:
	print(0)
else:
	if x > s:
		print(-1)
	if x == s:
		print(1)
		print(x)
	if x < s:
		if (x - s) % 2 == 1:
			print(-1)
		else:
			kan1 = []
			kan2 = []
			for i in range(len(xx)):
				if xx[i] == 0:
					kan1.append(0)
					kan2.append(0)
				else:
					kan1.append(1)
					kan2.append(0)
			for j in range(len(xx), len(ss)):
				kan1.append(0)
				kan2.append(0)
			ind = len(ss) - 1
			while odw(kan1) + odw(kan2) < s:
				while ind >= 0:
					if not (kan1[ind] == kan2[ind] and kan1[ind] == 0):
						ind -= 1
					elif 2 ** (ind + 1) + odw(kan1) + odw(kan2) > s:
						ind -= 1
					else:
						break
				if ind == -1:
					break
				kan1[ind] = 1
				kan2[ind] = 1
			if odw(kan1) + odw(kan2) == s:
				print(2)
				print(odw(kan1), odw(kan2))
			else:
				print(3)
				print(x, (s - x) // 2, (s - x) // 2)


MX = 64
(u, v) = map(int, input().split())
cx = list(map(int, reversed(bin(u)[2:])))
cx += [0] * (MX - len(cx))
cs = list(map(int, reversed(bin(v)[2:])))
cs += [0] * (MX - len(cs))
imp = False
for i in reversed(range(MX)):
	if cs[i] % 2 == cx[i]:
		continue
	if i == 0:
		imp = True
		break
	if cx[i] and cs[i] == 0:
		for j in range(i + 1, MX):
			if cs[j] >= 2:
				break
		else:
			imp = True
			break
		cs[j] -= 2
		for k in range(i + 1, j):
			cs[k] += 2
		cs[i] += 4
	cs[i] -= 1
	cs[i - 1] += 2
if imp:
	print(-1)
else:
	ans = [0] * max(cs)
	for i in range(MX):
		for j in range(cs[i]):
			ans[j] += 2 ** i
	print(len(ans))
	print(*ans)


import sys

def toBinary(n):
	arr = []
	k = n
	i = 0
	while k > 0:
		next = k % (2 * 2 ** i) // 2 ** i
		arr.append(next)
		k -= next * 2 ** i
		i += 1
	return arr
fptr = sys.stdout
uv = input().split()
u = int(uv[0])
v = int(uv[1])

def f(u, v):
	if u > v:
		fptr.write(str(-1))
		return
	if u == v and u == 0:
		fptr.write(str(0))
		return
	if u == v:
		fptr.write(str(1) + '\n')
		fptr.write(str(u))
		return
	if (v - u) % 2 == 1:
		fptr.write(str(-1))
		return
	diff = (v - u) // 2
	binV = toBinary(v)
	if u + diff ^ diff != u:
		fptr.write(str(3) + '\n')
		fptr.write(str(u) + ' ' + str(diff) + ' ' + str(diff))
		return
	fptr.write(str(2) + '\n')
	fptr.write(str(u + diff) + ' ' + str(diff))
f(u, v)
fptr.close()


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from math import *
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return map(int, data().split())
(u, v) = mdata()
if u == v:
	if u == 0:
		print(0)
	else:
		print(1)
		print(u)
elif u > v or (u + v) % 2 != 0:
	print(-1)
else:
	b = (u + v) // 2
	if b ^ v - b == u:
		print(2)
		print(b, v - b)
	else:
		print(3)
		print((v - u) // 2, (v - u) // 2, u)


from sys import stdin

def compute(S, X):
	A = (S - X) // 2
	a = 0
	b = 0
	for i in range(64):
		Xi = X & 1 << i
		Ai = A & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			return -1
	return (a, b)

def main():
	inp = stdin.readline
	(u, v) = map(int, inp().split())
	if u == 0 and v == 0:
		print(0)
	elif u > v or (v - u) % 2 != 0:
		print('-1')
	elif v - u == 0:
		print(1)
		print(u)
	else:
		f = compute(v, u)
		if f != -1:
			print(2)
			print(f[0], f[1])
		else:
			a = u
			b = (v - u) // 2
			print(3)
			print(a, b, b)
main()


import math
from bisect import bisect_left, bisect_right
from sys import stdin, stdout, setrecursionlimit
from collections import Counter
input = lambda : stdin.readline().strip()
print = stdout.write
(u, v) = map(int, input().split())
x = (v - u) // 2
if (v - u) % 2 or x < 0:
	print('-1\n')
elif x == 0:
	if u == 0:
		print('0\n')
	else:
		print('1\n')
		print(str(u) + '\n')
elif u & x == 0:
	print('2\n')
	print(str(u + x) + ' ' + str(x) + '\n')
else:
	print('3\n')
	print(str(u) + ' ' + str(x) + ' ' + str(x) + '\n')


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans

def is2(u, v):
	annd = (v - u) // 2
	a = 0
	b = 0
	for i in range(64):
		val = 1 << i
		if val & u == 0:
			if val & annd:
				a += val
				b += val
		else:
			a += val
	if a ^ b == u and a + b == v:
		print(2)
		print(a, b)
		return True
	return False
t = 1
for tt in range(t):
	(u, v) = map(int, sys.stdin.readline().split(' '))
	if u == 0 and v == 0:
		print(0)
		continue
	if u == v:
		print(1)
		print(u)
		continue
	if (v - u) % 2 != 0 or u > v:
		print(-1)
		continue
	if is2(u, v):
		continue
	d = v - u
	dd = d // 2
	print(3)
	print(u, dd, dd)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


import sys
from math import *
from collections import defaultdict
from queue import deque
from heapq import heappush, heappop
lines = [line.strip() for line in sys.stdin.readlines()]
(u, v) = list(map(int, lines[0].split()))

def f(u, v):
	if u > v:
		return None
	if u == 0 and v == 0:
		return []
	if u == v:
		return [u]
	y = v - u
	z = y // 2
	if y % 2 == 0:
		if u + z ^ z == u:
			return [u + z, z]
		else:
			return [u, z, z]
	return None
xs = f(u, v)
if xs is None:
	print(-1)
else:
	print(len(xs))
	if xs:
		print(' '.join(map(str, xs)))


(u, v) = map(int, input().split())
if u == v:
	if u > 0:
		ans = [u]
	else:
		ans = []
elif u > v:
	ans = None
else:
	diff = v - u
	if diff % 2:
		ans = None
	elif u + diff // 2 == u ^ diff // 2:
		ans = [u + diff // 2, diff // 2]
	else:
		ans = [u, diff // 2, diff // 2]
if ans is None:
	print(-1)
else:
	print(len(ans))
	print(' '.join(map(str, ans)))
	if sum(ans) != v:
		raise ValueError(ans)


data = input().rstrip().split()
(x, s) = (int(data[0]), int(data[1]))

def main(s, x):
	if s == x:
		if s == 0:
			print(0)
		else:
			print(1)
			print(x)
	else:
		d = s - x
		if d < 0 or d % 2 == 1:
			print(-1)
			return
		a = d // 2
		b = x
		if a + b == a ^ b:
			print(2)
			print(str(a) + ' ' + str(a + b))
		else:
			print(3)
			print(str(a) + ' ' + str(a) + ' ' + str(b))
main(s, x)


import sys
import math

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def read():
	return int(input())

def reads():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(u, v) = reads()
if u > v or u & 1 != v & 1:
	print(-1)
elif u == 0 and v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
else:
	w = v - u >> 1
	o = w & u
	if o:
		print(3)
		print(w, w, u)
	else:
		print(2)
		print(w + u, w)


from collections import defaultdict
from operator import itemgetter
import sys
input = sys.stdin.readline

def solve(u, v):
	vv = v - u
	if vv < 0 or vv % 2 == 1:
		print(-1)
		return 1
	v2 = vv // 2
	if u == 0 and v == 0:
		print(0)
	elif vv == 0:
		print(1)
		print(u)
	elif u | v2 == u + v2:
		print(2)
		print(u + v2, v2)
	else:
		print(3)
		print(u, v2, v2)

def main():
	(u, v) = map(int, input().split())
	solve(u, v)
main()


import sys
from functools import reduce
from operator import xor
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

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

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(U, V):
	if U == 0 and V == 0:
		print(0)
		return
	if U > V:
		print(-1)
		return
	if U == V:
		print(1)
		print(U)
		return
	if U & 1 != V & 1:
		print(-1)
		return
	x = U
	y = (V - U) // 2
	if x & y == 0:
		print(2)
		print(x + y, y)
	else:
		print(3)
		print(x, y, y)

def main():
	(U, V) = read_int_n()
	slv(U, V)
main()


import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(u, v) = [int(i) for i in input().split()]
if u > v or (v - u) % 2:
	print(-1)
elif u == v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
else:
	ans = []
	b = bin(u)[2:][::-1]
	diff = v - u
	diff = diff // 2
	bd = bin(diff)[2:][::-1]
	flag = 0
	for i in range(min(len(b), len(bd))):
		if b[i] == '1' and bd[i] == '1':
			print(3)
			print(u, diff, diff)
			flag = 1
			break
	if flag == 0:
		print(2)
		print(u + diff, diff)


(u, v) = map(int, input().split())
ans = []
tmp = v
for i in range(1000):
	if u >> i & 1 == 1 and v >> i & 1 == 0:
		if i - 1 < 0:
			print(-1)
			exit()
		ans.append(1 << i - 1)
		ans.append(1 << i - 1)
		ans.append(1 << i)
		v -= 1 << i + 1
	elif u >> i & 1 == 0 and v >> i & 1 == 1:
		if i - 1 < 0:
			print(-1)
			exit()
		ans.append(1 << i - 1)
		ans.append(1 << i - 1)
	elif u >> i & 1 == 1 and v >> i & 1 == 1:
		ans.append(1 << i)
	elif u >> i & 1 == 0 and v >> i & 1 == 0:
		pass
if sum(ans) != tmp:
	print(-1)
	exit()
cnt = [0] * 100
for num in ans:
	for i in range(100):
		if 1 << i & num:
			cnt[i] += 1
res = []
for i in range(len(ans)):
	tmp = 0
	for i in range(100):
		if cnt[i] >= 1:
			tmp += 1 << i
			cnt[i] -= 1
	if tmp > 0:
		res.append(tmp)
	else:
		break
print(len(res))
print(*res)


import sys
input = sys.stdin.readline
(u, v) = map(int, input().split())
if u == v == 0:
	print(0)
elif u == v:
	print(1)
	print(u)
elif v > u and (v - u) % 2 == 0:
	a = (v - u) // 2
	if u & a:
		print(3)
		print(a, a, u)
	else:
		print(2)
		x = a | u
		print(x, a)
else:
	print(-1)


import sys

def main():
	(u0, v) = map(int, input().split())
	if u0 > v or (v - u0) % 2 != 0:
		print(-1)
		return 0
	u = [0 for i in range(100)]
	curr = 0
	while u0 > 0:
		u[curr] = u0 % 2
		u0 //= 2
		curr += 1
	out = [0 for i in range(100)]
	s = 0
	for i in range(99, -1, -1):
		if u[i]:
			s += 1 << i
			out[0] += 1 << i
	for i in range(99, -1, -1):
		cnt = 0
		if u[i]:
			cnt = 1
		while s + (1 << i + 1) <= v:
			s += 1 << i + 1
			out[cnt] += 1 << i
			out[cnt + 1] += 1 << i
			cnt += 2
	if s != v:
		print(-1)
		return 0
	ans = 0
	for i in range(0, 100):
		ans += out[i] != 0
	print(ans)
	for i in range(0, 100):
		if out[i] == 0:
			break
		print(out[i], end=' ')
main()


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
(u, v) = li()
if u == v == 0:
	print(0)
	exit()
if u == v:
	print(1)
	print(u)
	exit()
req = v - u
if req & 1 or req < 0:
	print(-1)
	exit()
elif u + req // 2 ^ req // 2 == u:
	print(2)
	print(u + req // 2, req // 2)
else:
	print(3)
	print(u, req // 2, req // 2)


(a, b) = map(int, input().split())

def f(a, b):
	if b - a < 0 or (b - a) % 2 == 1:
		print(-1)
	elif b == 0:
		print(0)
	elif a == b:
		print(1)
		print(b)
	else:
		x = (b - a) // 2
		if a ^ x == a + x:
			sol = [a + x, x]
		else:
			sol = [a, x, x]
		print(len(sol))
		print(' '.join([str(i) for i in sol]))
f(a, b)


(u, v) = list(map(int, input().split()))
if u > v:
	print(-1)
elif u == v:
	if u == v == 0:
		print(0)
	else:
		print(1)
		print(u)
elif (v - u) % 2 == 1:
	print(-1)
else:
	a = u
	b = 0
	for i in reversed(list(range(65))):
		res = v - (a + b)
		if u & 1 << i:
			continue
		if res >= 2 * (1 << i):
			a += 1 << i
			b += 1 << i
		else:
			continue
	if a + b == v:
		print(2)
		print(a, b)
	else:
		print(3)
		k = (v - u) // 2
		print(u, k, k)


def f():
	(xor, sum) = [int(s) for s in input().split()]
	rem = sum - xor
	if rem < 0 or rem & 1:
		print(-1)
		return
	if sum == 0:
		print(0)
		return
	if rem == 0:
		print(1)
		print(xor)
		return
	rem >>= 1
	if rem & xor == 0:
		print(2)
		print('{} {}'.format(rem + xor, rem))
		return
	print(3)
	print('{} {} {}'.format(rem, rem, xor))
f()


import sys
(u, v) = map(int, input().split())
if u > v:
	print(-1)
	sys.exit(0)
if u == v and u == 0:
	print(0)
	sys.exit(0)
if u == v:
	print(1)
	print(u)
	sys.exit(0)
if (v - u) % 2 == 1:
	print(-1)
	sys.exit(0)
ans = [0] * 64
ans[0] = u
v -= u
for i in range(65, -1, -1):
	if u & 1 << i:
		j = 63
		while (1 << i) * (j - 1) > v:
			j -= 2
		v -= (1 << i) * (j - 1)
		for k in range(1, j):
			ans[k] += 1 << i
	else:
		j = 64
		while (1 << i) * j > v:
			j -= 2
		v -= (1 << i) * j
		for k in range(j):
			ans[k] += 1 << i
if v != 0:
	print(-1)
	sys.exit(0)
i = 0
answ = []
while ans[i] != 0:
	answ.append(ans[i])
	i += 1
print(len(answ))
print(*answ)


import math
from bisect import bisect_left, bisect_right
from sys import stdin, stdout, setrecursionlimit
from collections import Counter
input = lambda : stdin.readline().strip()
print = stdout.write
(u, v) = map(int, input().split())
x = (v - u) // 2
if (v - u) % 2 or x < 0:
	print('-1\n')
elif x == 0:
	if u == 0:
		print('0\n')
	else:
		print('1\n')
		print(str(u) + '\n')
else:
	p = bin(x)[2:]
	q = bin(u)[2:]
	p = p.rjust(max(len(p), len(q)), '0')
	q = q.rjust(max(len(p), len(q)), '0')
	a = ''
	b = ''
	for i in range(max(len(p), len(q))):
		if p[i] == '0' and q[i] == '0':
			a += '0'
			b += '0'
		elif p[i] == '0' and q[i] == '1':
			a += '0'
			b += '1'
		elif p[i] == '1' and q[i] == '0':
			a += '1'
			b += '1'
		else:
			print('3\n')
			print(str(u) + ' ' + str(x) + ' ' + str(x) + '\n')
			break
	else:
		print('2\n')
		print(str(int(a, 2)) + ' ' + str(int(b, 2)) + '\n')


(a, b) = list(map(int, input().split()))
if a == b and a == 0:
	print(0)
elif a == b:
	print(1)
	print(a)
elif a > b:
	print(-1)
elif (b - a) % 2 == 0:
	c = (b - a) // 2
	if c ^ a == c + a:
		print(2)
		print(c + a, c)
	else:
		print(3)
		print(c, c, a)
else:
	print(-1)


from sys import stdin
input = stdin.buffer.readline
(u, v) = map(int, input().split())
if u > v or u & 1 != v & 1:
	print(-1)
elif u == v:
	print('1\n{}'.format(u) if u else '0')
else:
	z = (v - u) // 2
	print('3\n{} {} {}'.format(u, z, z) if u & z != 0 else '2\n{} {}'.format(u + z, z))


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
for tt in range(t):
	(u, v) = invr()
	if (u - v) % 2 != 0 or u > v:
		print(-1)
	elif u == 0 and v == 0:
		print(0)
	elif u == v:
		print(1)
		print(u)
	elif u & (v - u) // 2 == 0:
		print(2)
		print((u + v) // 2, (v - u) // 2)
	else:
		print(3)
		print(u, (v - u) // 2, (v - u) // 2)


from sys import stdin

def mp():
	return map(int, stdin.readline().split())

def ml():
	return list(map(int, stdin.readline().split()))
(xor, sm) = mp()
if xor > sm:
	print(-1)
elif (sm - xor) % 2 == 1:
	print(-1)
else:
	n1 = xor
	n2 = (sm - xor) // 2
	if n1 == 0 and n2 == 0:
		print(0)
	elif n2 == 0:
		print(1)
		print(n1)
	elif n2 + n1 ^ n2 == xor:
		print(2)
		print(n2 + n1, n2)
	elif n2 + n2 ^ n1 == xor:
		print(2)
		print(n2 + n2, n1)
	else:
		print(3)
		print(n1, n2, n2)


(u, v) = [int(x) for x in input().split()]
if u == v == 0:
	print(0)
	exit()
if u == v:
	print('1\n' + str(u))
	exit()
if u > v:
	print(-1)
	exit()
if (u - v) % 2 == 1:
	print(-1)
	exit()
a = (v - u) // 2
b = v - a
if a & b != a:
	print('3\n' + str(u) + ' ' + str(a) + ' ' + str(a))
else:
	print('2\n' + str(a) + ' ' + str(b))


(u, v) = map(int, input().split())
if u > v or u % 2 != v % 2:
	print(-1)
	exit()
if u == 0 and v == 0:
	print(0)
	exit()
if u == v:
	print(1)
	print(u)
	exit()
w = (v - u) // 2
W = format(w, 'b')
U = format(u, 'b')
L = max(len(W), len(U))
W = '0' * (L - len(W)) + W
U = '0' * (L - len(U)) + U
(a, b) = (0, 0)
for i in range(L):
	if W[i] == '1':
		if U[i] == '1':
			print(3)
			print(w, w, u)
			break
		else:
			a += 2 ** (L - 1 - i)
			b += 2 ** (L - 1 - i)
	elif U[i] == '1':
		a += 2 ** (L - 1 - i)
else:
	print(2)
	print(a, b)


from sys import stdin
(u, v) = map(int, stdin.readline().split())
k = u
if (u - v) % 2 != 0:
	print(-1)
	exit()
if u == v:
	if u == 0:
		print(0)
		exit()
	else:
		print(1)
		print(u)
		exit()
if v < u:
	print(-1)
	exit()
x = (v - u) // 2
u = [int(z) for z in list(bin(u)[2:][::-1])]
x_b = [int(z) for z in list(bin(x)[2:][::-1])]
l = max(len(u), len(x_b))
u += [0] * (l - len(u))
x_b += [0] * (l - len(x_b))
ans = []
(c, d) = ([], [])
for i in range(l):
	(a, b) = (u[i], x_b[i])
	if a == b == 1:
		print(3)
		print(k, x, x)
		break
	elif a == b == 0:
		c.append(0)
		d.append(0)
	elif a == 1 and b == 0:
		c.append(1)
		d.append(0)
	else:
		c.append(1)
		d.append(1)
	if i == l - 1:
		c = ''.join([str(x) for x in c[::-1]])
		d = ''.join([str(x) for x in d[::-1]])
		(c, d) = (int(c, 2), int(d, 2))
		print(2)
		print(c, d)


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 compute(S, X):
	A = (S - X) // 2
	a = 0
	b = 0
	for i in range(64):
		Xi = X & 1 << i
		Ai = A & 1 << i
		if Xi == 0 and Ai == 0:
			pass
		elif Xi == 0 and Ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif Xi > 0 and Ai == 0:
			a = 1 << i | a
		else:
			return -1
	return [a, b]
(x, y) = map(int, input().split())
if y == 0 and x == 0:
	print(0)
	quit()
if y == 0:
	print(-1)
	quit()
if x == 0:
	if y % 2 == 0:
		print(2)
		print(y // 2, y // 2)
		quit()
	else:
		print(-1)
		quit()
if x == y:
	print(1)
	print(x)
	quit()
if x > y:
	print(-1)
	quit()
diff = y - x
if diff % 2 == 0:
	ans = compute(y, x)
	if ans != -1:
		print(2)
		print(ans[0], ans[1])
	else:
		print(3)
		print(x, diff // 2, diff // 2)
else:
	print(-1)


sp = lambda : list(map(int, input().split()))
si = lambda : int(input())
(u, v) = sp()
k = (v - u) // 2
if u > v or u % 2 != v % 2:
	print(-1)
elif u == 0:
	if v == 0:
		print(0)
	else:
		print(2)
		print(k, k)
elif k == 0:
	print(1)
	print(u)
elif k & u == 0:
	print(2)
	print(u + k, k)
else:
	print(3)
	print(u, k, k)


(x, s) = [int(i) for i in input().split()]
flag = 0
if x > s or (s - x) % 2 == 1:
	print(-1)
elif s + x == 0:
	print(0)
elif s == x:
	print(1)
	print(s)
else:
	x1 = x + (s - x) // 2
	x2 = (s - x) // 2
	if x1 ^ x2 == x:
		print(2)
		print(x1, x2)
	else:
		print(3)
		print(x2, x2, x1 - x2)


(u, v) = map(int, input().split())
if u % 2 != v % 2 or u > v:
	print(-1)
	exit()
s = bin(u)[2:].rjust(60, '0')
cnt = [0] * 60
for i in range(60):
	cnt[i] += int(s[i])
dif = v - u
for i in range(60):
	if i == 55:
		h = 0
	cur = dif // (1 << 60 - i - 1)
	cur -= cur % 2
	if 1 << 60 - i - 1 <= dif and cur != 0:
		cnt[i] += cur
		dif -= (1 << 60 - i - 1) * cur
ans = [[0 for i in range(60)] for j in range(max(cnt))]
for i in range(len(ans)):
	for j in range(60):
		if ans[i][j] == 0 and cnt[j] != 0:
			ans[i][j] += 1
			cnt[j] -= 1
for i in range(len(ans)):
	for j in range(60):
		ans[i][j] = str(ans[i][j])
print(len(ans))
for i in ans:
	print(int(''.join(i), 2), end=' ')


def compute(x, s):
	rem = (s - x) // 2
	(a, b) = (0, 0)
	for i in range(64):
		j = x & 1 << i
		k = rem & 1 << i
		if j == 0 and k == 0:
			pass
		elif j == 0 and k > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif j > 0 and k == 0:
			a = 1 << i | a
		else:
			print(3)
			print(x, rem, rem)
			return
	print(2)
	print(a, b)
(x, s) = map(int, input().split())
if x == 0 and s == 0:
	print(0)
elif x == s:
	print(1)
	print(x)
elif x > s or (x - s) % 2 == 1:
	print(-1)
else:
	compute(x, s)


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
for tt in range(t):
	(u, v) = map(int, input().split())
	if u == 0 and v == 0:
		print(0)
		break
	elif u == 0 and v % 2 == 0:
		print(2)
		print(v // 2, v // 2)
		break
	elif u == 0 or v == 0:
		print(-1)
		break
	q = list(map(int, list(reversed(list('0' * (64 - int(math.log(u) // math.log(2))) + bin(u).replace('0b', ''))))))
	w = list(map(int, list(reversed(list('0' * (64 - int(math.log(v) // math.log(2))) + bin(v).replace('0b', ''))))))
	qw = 0
	for i in range(63, -1, -1):
		if w[i] % 2 == q[i]:
			continue
		if i == 0:
			qw = 1
			break
		if q[i] and w[i] == 0:
			for j in range(i + 1, 64):
				if w[j] >= 2:
					break
			else:
				qw = 1
			w[j] = w[j] - 2
			for k in range(i + 1, j):
				w[k] = w[k] + 2
			w[i] = w[i] + 4
		w[i] = w[i] - 1
		w[i - 1] = w[i - 1] + 2
	if qw == 1:
		print(-1)
	else:
		qwqw = [0] * max(w)
		for i in range(64):
			for j in range(w[i]):
				qwqw[j] = qwqw[j] + 2 ** i
		print(len(qwqw))
		print(*qwqw)


(u, v) = list(map(int, input().split()))
if (v - u) % 2 == 1:
	print(-1)
elif v == 0 and u == 0:
	print(0)
elif v < u:
	print(-1)
elif v == u:
	print(1)
	print(u)
else:
	bu = bin(u)
	bv = bin(v)
	k = (v - u) // 2
	bk = bin(k)
	if u ^ k == u + k:
		print(2)
		print(k, k + u)
	else:
		print(3)
		print(u, k, k)


def solve():
	(u, v) = map(int, input().split())
	if u > v:
		print('-1')
		return
	if u % 2 != v % 2:
		print('-1')
		return
	if u == 0 and v == 0:
		print(0)
		return
	if u == v:
		print(1)
		print(u)
		return
	x = (v - u) // 2
	if u & x:
		print(3)
		print(u, end=' ')
		print(x, end=' ')
		print(x)
		return
	print(2)
	print(u + x, end=' ')
	print(x)
solve()


from sys import stdin
for line in stdin:
	(u, v) = map(int, line.split())
	if u > v or (v - u) % 2 == 1:
		print('-1')
	elif u == v:
		if v == 0:
			print('0')
		else:
			print('1')
			print(u)
	else:
		t = (v - u) // 2
		if u & t == 0:
			print('2')
			print(f'{u + t} {t}')
		else:
			print('3')
			print(f'{u} {t} {t}')


def solve(u, v):
	if u == v:
		return [u]
	elif u > v:
		return None
	if (v - u) % 2 == 0:
		x = (v - u) // 2
		if u & x == 0:
			return [u | x, x]
		else:
			return [u, x, x]
	else:
		return None
(u, v) = map(int, input().split())
r = solve(u, v)
if not r:
	print(-1)
elif u == v == 0:
	print(0)
else:
	print('{}\n{}'.format(len(r), ' '.join(map(str, r))))


from math import *

def binarySearch(arr, x, i):
	l = i
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x, i):
	l = i
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans

def c(s, x):
	A = (s - x) // 2
	a = 0
	b = 0
	for i in range(64):
		xi = x & 1 << i
		ai = A & 1 << i
		if xi == 0 and ai == 0:
			pass
		elif xi == 0 and ai > 0:
			a = 1 << i | a
			b = 1 << i | b
		elif xi > 0 and ai == 0:
			a = 1 << i | a
		else:
			return None
	return (a, b)
(u, v) = map(int, input().split())
if u > v or (v - u) % 2:
	print(-1)
elif u == v == 0:
	print(0)
elif u == v:
	print(1)
	print(v)
elif c(v, u) != None:
	(a, b) = c(v, u)
	print(2)
	print(a, b)
else:
	print(3)
	print(u, (v - u) // 2, (v - u) // 2)


from sys import stdin
from bisect import bisect_left as bl
from bisect import bisect_right as br

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())

class RangedList:

	def __init__(self, start, stop, val=0):
		self.shift = 0 - start
		self.start = start
		self.stop = stop
		self.list = [val] * (stop - start)

	def __setitem__(self, key, value):
		self.list[key + self.shift] = value

	def __getitem__(self, key):
		return self.list[key + self.shift]

	def __repr__(self):
		return str(self.list)

	def __iter__(self):
		return iter(self.list)

def dprint(*args, **kwargs):
	if debugging:
		print(*args, **kwargs)

def conv(x):
	return int(''.join((str(k) for k in x)), 2)
debugging = 1
(xor, total) = intsput()
xor = bin(xor)[2:]
xor = list(map(int, list('0' * (64 - len(xor)) + xor)))
rem = total
req = [0] * 64
for i in range(len(xor)):
	if xor[i]:
		fits = rem // 2 ** (63 - i)
		if not fits and xor[i]:
			print(-1)
			exit()
		if fits:
			if not xor[i]:
				fits -= fits % 2
			else:
				fits += fits % 2 - 1
			req[i] += 1 if fits else 0
			rem -= (1 if fits else 0) * 2 ** (63 - i)
for i in range(len(xor)):
	fits = rem // 2 ** (63 - i)
	if fits:
		fits -= fits % 2
		req[i] += fits
		rem -= fits * 2 ** (63 - i)
if rem:
	print(-1)
	exit()
m = max(req)
print(m)
for _ in range(m):
	container = [0] * 64
	for i in range(len(req)):
		if req[i]:
			container[i] = 1
			req[i] -= 1
	print(conv(container), end=' ')
print()


from sys import stdin
input = lambda : stdin.readline().strip()
lin = lambda : list(map(int, input().split()))
iin = lambda : int(input())
main = lambda : map(int, input().split())
from math import ceil, sqrt, factorial, log
from collections import deque
from bisect import bisect_left
mod = 998244353
mod = 1000000007

def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	while a % b != 0:
		(a, b) = (b, a % b)
	return b

def moduloinverse(a):
	return pow(a, mod - 2, mod)

def solve(we):
	(a, b) = main()
	if a > b or a % 2 != b % 2:
		print(-1)
		return
	if a == b:
		if a == 0:
			print(0)
		else:
			print(1)
			print(a)
		return
	x = (b - a) // 2
	if a & x:
		print(3)
		print(a, x, x)
	else:
		print(2)
		print(a ^ x, x)
qwe = 1
for _ in range(qwe):
	solve(_ + 1)