#include <iostream>
using namespace std;

int N,K;

int main(){
	cin>>N>>K;
	if(N<K) cout<<"INF"<<endl;
	else{
		int t=0;
		for(int i=N;i<=2*N;i++) for(int j=0;j<=K;j++) if((i&(i+j))==N) t++;
		cout<<t<<endl;
	}
}