#include using namespace std; //#define MOD 1000000007 #define MOD 998244353 #define INF 100000000000000009 typedef long long ll; #define REP(i,n) for(int i=0;i<(n);++i) #define OREP(i,n) for(int i=1;i<=(n);++i) #define ZREP(i,n) for(int i=1;i<(n);++i) #define YES(s) s?cout << "YES" << endl:cout << "NO" << endl #define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl #define out(s,t,u) s?cout << t << endl:cout << u << endl #define int ll #define Endl endl int V; int N,K; vector G; int B[57]; int saiki(int W,int D){ //cout << W << " " << D << endl; if(W==0){ if(0<=D && D=0){ r+=saiki(W-1,D-s); //} return r; } signed main(){ cin >> N >> K; if(N==0){ if(K==0){ cout << 1 << endl; }else{ cout << "INF" << endl; } return 0; } int M=N; int e=1; while(M){ if(M%2==0){ G.push_back(e); } e*=2; M/=2; } G.push_back(2*e); G.push_back(4*e); G.push_back(8*e); V=G.size(); if(V==0){ cout << 1 << endl; return 0; } //REP(i,V){cout << G[i] << " ";} B[0]=G[0]; REP(i,V-1){ B[i+1]=B[i]+G[i+1]; } cout << saiki(V,0) << endl; return 0; }