#include #include using lint = long long; void solve() { int k, x; std::cin >> k >> x; if (x == 0) { std::cout << "Yes\n" << 1 << "\n" << (k == 0 ? 1 : 0) << "\n"; return; } if (k == 0) ++x; if (__builtin_popcount(x) != 1) { std::cout << "No\n"; return; } int p = __builtin_ctz(x); std::vector ans; int b = 0; for (int i = 0; i < 20; ++i) { if ((~k >> i) & 1) continue; ans.push_back(1 << i); b |= (1 << i); } { int i = 0; while ((1 << (int)ans.size()) < p) { while ((b >> i) & 1) ++i; ans.push_back(1 << i); b |= (1 << i); } } { int y = 0; for (int q = 0; q < p; ++q) { while ((b & y) != y) ++y; ans.push_back(y++); } } if ((int)ans.size() > 40) { std::cout << "No\n"; } else { std::cout << "Yes\n" << ans.size() << "\n"; for (auto a : ans) std::cout << a << " "; std::cout << "\n"; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }