#include using namespace std; using ll = long long; #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define ALL(v) (v).begin(), (v).end() #define p(s) cout<<(s)< void vprint(T &V){ for(auto v : V){ cout << v << " "; } cout << endl; } int main(){ cin.tie(0); ios::sync_with_stdio(false); // input ll N, K; cin >> N >> K; if(N==0){ if(K==0){ p(1); return 0; }else{ p("INF"); return 0; } } ll count = 0; FOR(x, 0, 100001){ FOR(k, 0, K+1){ ll y = x + k; ll z = x & y; if(z == N){ count++; } } } p(count); return 0; }