n, k = map(int, input().split()) if n < k: print("INF") exit() ans = 0 for i in range(n, n + k + 1): for j in range(i, i + k + 1): if i & j == n: ans += 1 print(ans)