/* -*- coding: utf-8 -*- * * 822.cc: No.822 Bitwise AND - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ /* typedef */ /* global variables */ /* subroutines */ /* main */ int main() { int n, k; scanf("%d%d", &n, &k); if (n < k) { puts("INF"); return 0; } int b = 1; while (b <= n) b <<= 1; int cnt = 0; for (int x = 0; x < b; x++) for (int dy = 0; dy <= k; dy++) if ((x & (x + dy)) == n) cnt++; printf("%d\n", cnt); return 0; }