#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); ll N, K; cin >> N >> K; if (N + 1 <= K) { cout << "INF" << endl; return 0; } int ans = 0; ll p = 1LL; while (p < N) {p *= 2;} for (ll y = N; y <= p; ++y){ if ((y & N) != N) continue; for (ll x = max(N, y - K); x <= y; ++x){ if ((x & y) == N) {++ans;} } } cout << ans << endl; return 0; }