#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 7, INF = 1e16 + 7, mod = 998244353;
const double PI = 3.141592653589793238462643383279502884197, eps = 1e-9;
bool b(long long x, long long y) { return x & (1ll << y); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long u, v;
  bool rem = 0;
  vector<long long> vec;
  cin >> u >> v;
  for (int i = 0; i < 64; i++) {
    if (rem) {
      if (b(v, i))
        rem = 0, v ^= (1ll << i);
      else
        v |= (1ll << i);
    }
    if (b(u, i) && (b(u, i) == b(v, i)))
      vec.push_back((1ll << i));
    else if (b(u, i) || b(v, i)) {
      if (!i) return cout << -1, 0;
      if (b(v, i)) {
        vec.push_back((1ll << (i - 1)));
        vec.push_back((1ll << (i - 1)));
      } else {
        vec.push_back((1ll << (i - 1)));
        vec.push_back((1ll << (i - 1)) + (1ll << i));
        rem = 1;
      }
    }
  }
  if (rem) return cout << -1, 0;
  cout << vec.size() << '\n';
  for (long long i : vec) cout << i << ' ';
  return 0;
}
