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.

Difficulty: interview

Starter code:

Solutions:
u, v = list(map(int, input().split()))
if v < u or (v - u) % 2 != 0:
    print(-1)
else:
    if 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))



v, u = list(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)
        
        


#!/usr/bin/env python
#-*- coding:utf-8 -*-

# Code by H~$~C

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 = ' ')

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()))
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))


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)
else:
	if (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)

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)


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)

import sys
input = sys.stdin.readline

u,v=list(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=v-A-B

    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)
    
    


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)

import sys

input = sys.stdin.readline
# fin = open('input.txt', 'r')
# input = fin.readline


def solve():
    u, v = list(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()


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 = rlinput() rinput() iinput() input()
    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()

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))

import sys
readline = sys.stdin.readline

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

if u > v:
    print(-1)
elif (v-u) & 1:
    print(-1)
elif u == v == 0:
    print(0)
elif u == v:
    print(1)
    print(u)
elif u == 0:
    print(2)
    print(v>>1, v>>1)
else:
    x = (v-u)>>1
    if u & x:
        print(3)
        print(u, x, x)
    else:
        print(2)
        print(u|x, x)

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))
    else:    
        if a&(k//2)==0:
            print(2)
            print(a+k//2,k//2)
        else:
            print(3)
            print(a,k//2,k//2)