#include <bits/stdc++.h>
using namespace std;
int main()
{
bool arr[1000001]={0};
vector<long long> MyPrimes;
int Q;
int w;
arr[0]=1;
arr[1]=1;
for(Q=2;Q<=100000;Q++)
{
if(arr[Q]==0);
for(w=Q*2;w<=1000000;w+=Q)
{
arr[w]=1;
}
}
for(Q=1;Q<=1000000;Q++)
{
if(arr[Q]==0)
MyPrimes.push_back(Q);
}
int q,e,r;
long long a,b;
cin>>a>>b;
if(a==b)
{
cout<<"infinity\n";
return 0;
}
if(b>a)
{
cout<<0<<"\n";
return 0;
}
long long SOL=a-b;
vector<long long> MyPrimeFactors;
set<int>SOLUIONZZZZ;
for(q=0;q<MyPrimes.size();q++)
{
while(SOL%MyPrimes[q]==0)
{
MyPrimeFactors.push_back(MyPrimes[q]);
SOL=SOL/MyPrimes[q];
}
}
if(SOL>1000000)
MyPrimeFactors.push_back(SOL);
long long Limit=pow(2,MyPrimeFactors.size())+0.5;
Limit--;
long long mysolution=0;
for(q=0;q<=Limit;q++)
{
long long Currentdiv=1;
for(w=0;w<MyPrimeFactors.size();w++)
{
long long current=(1<<w);
if(q¤t)
Currentdiv*=MyPrimeFactors[w];
}
if(Currentdiv>b)
{
SOLUIONZZZZ.insert(Currentdiv);
}
}
cout<<SOLUIONZZZZ.size()<<"\n";
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKCgoKaW50IG1haW4oKQp7CiAgICBib29sIGFyclsxMDAwMDAxXT17MH07CiAgICB2ZWN0b3I8bG9uZyBsb25nPiBNeVByaW1lczsKICAgICBpbnQgUTsKICAgICBpbnQgdzsKICAgIGFyclswXT0xOwogICAgYXJyWzFdPTE7CiAgICBmb3IoUT0yO1E8PTEwMDAwMDtRKyspCiAgICB7CiAgICAgICAgaWYoYXJyW1FdPT0wKTsKICAgICAgICBmb3Iodz1RKjI7dzw9MTAwMDAwMDt3Kz1RKQogICAgICAgIHsKICAgICAgICAgICAgYXJyW3ddPTE7CiAgICAgICAgfQogICAgfQoKICAgIGZvcihRPTE7UTw9MTAwMDAwMDtRKyspCiAgICB7CiAgICAgaWYoYXJyW1FdPT0wKQogICAgICAgIE15UHJpbWVzLnB1c2hfYmFjayhRKTsKCiAgICB9CiAgICBpbnQgcSxlLHI7CmxvbmcgbG9uZyBhLGI7CgogICAgIGNpbj4+YT4+YjsKCiAgICBpZihhPT1iKQogICAgewogICAgICAgIGNvdXQ8PCJpbmZpbml0eVxuIjsKICAgICAgICByZXR1cm4gMDsKICAgIH0KICAgIGlmKGI+YSkKICAgIHsKICAgICAgICBjb3V0PDwwPDwiXG4iOwogICAgICAgIHJldHVybiAwOwogICAgfQoKICAgIGxvbmcgbG9uZyBTT0w9YS1iOwogICAgdmVjdG9yPGxvbmcgbG9uZz4gTXlQcmltZUZhY3RvcnM7CiAgICBzZXQ8aW50PlNPTFVJT05aWlpaOwoKICAgIGZvcihxPTA7cTxNeVByaW1lcy5zaXplKCk7cSsrKQogICAgewoKICAgICAgICB3aGlsZShTT0wlTXlQcmltZXNbcV09PTApCiAgICAgICAgewoKCgogICAgICAgICAgICBNeVByaW1lRmFjdG9ycy5wdXNoX2JhY2soTXlQcmltZXNbcV0pOwoKCiAgICAgICAgICAgIFNPTD1TT0wvTXlQcmltZXNbcV07CgoKICAgICAgICB9CiAgICB9CgogICAgaWYoU09MPjEwMDAwMDApCiAgICAgICAgTXlQcmltZUZhY3RvcnMucHVzaF9iYWNrKFNPTCk7CgogICAgbG9uZyBsb25nIExpbWl0PXBvdygyLE15UHJpbWVGYWN0b3JzLnNpemUoKSkrMC41OwogICAgTGltaXQtLTsKCiAgICBsb25nIGxvbmcgbXlzb2x1dGlvbj0wOwogICAgZm9yKHE9MDtxPD1MaW1pdDtxKyspCiAgICB7CiAgICAgICAgbG9uZyBsb25nIEN1cnJlbnRkaXY9MTsKICAgICAgICBmb3Iodz0wO3c8TXlQcmltZUZhY3RvcnMuc2l6ZSgpO3crKykKICAgICAgICB7CiAgICAgICAgICAgIGxvbmcgbG9uZyBjdXJyZW50PSgxPDx3KTsKICAgICAgICAgICAgaWYocSZjdXJyZW50KQogICAgICAgICAgICAgICAgQ3VycmVudGRpdio9TXlQcmltZUZhY3RvcnNbd107CiAgICAgICAgfQoKICAgICAgICBpZihDdXJyZW50ZGl2PmIpCiAgICAgICAgICB7CgogICAgICAgICAgICAgIFNPTFVJT05aWlpaLmluc2VydChDdXJyZW50ZGl2KTsKICAgICAgICAgIH0KICAgIH0KICAgIGNvdXQ8PFNPTFVJT05aWlpaLnNpemUoKTw8IlxuIjsKCgoKCgogICAgcmV0dXJuIDA7Cn0K