#include #include using namespace std; int main(){ int n, k; cin >> n >> k; int add = 1, val = -1; while(add <= k){ if( (n&(n+add)) == n) val = add; add++; } int nn = n+add; int a = floor(log2(nn)), b = floor(log2(n)); if(add != -1 && ((add <= k && a >= b) || (n==0 && k!=0))){ cout << "INF" << endl; return 0; } int ans = 0; for(int s = 0; s < (1<<18); s++){ bool ok = true; int x = n; for(int j = 0; j < 18; j++){ if(((s>>j)&1) == 1 && ((n>>j)&1) == 1) ok = false; if((s>>j)&1) x += 1<