#include #include #include #include #include #include #include using namespace std; using ll = long long; int main() { int n, k; cin >> n >> k; if (k >= n + 1) { cout << "INF" << endl; } else { int s = 0; for (int i = n; i <= n * 2; i++) { for (int j = i - k; j <= i; j++) { if ((i & j) == n) s++; } } cout << s << endl; } return 0; }