#include void solve() { int n, k; std::cin >> n >> k; if (n + 1 <= k) { std::cout << "INF\n"; return; } int ans = 0; for (int x = 0; x <= n * 2; ++x) { for (int d = 0; d <= k; ++d) { if ((x & (x + d)) == n) ++ans; } } std::cout << ans << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }