#include<bits/stdc++.h>
using namespace std;
int a,b,c,ans;
inline int read(){
int ret=0,f=1;char ch=getchar();
while(!isdigit(ch)) f=(ch=='-'?-f:f),ch=getchar();
while(isdigit(ch)) ret=ret*10+ch-'0',ch=getchar();
return ret*f;
}
int check(int x,int y){
if(x%y==0) return y;
return check(y,x%y);
}
int main(){
a=read();b=read();c=b/a;
for(int i=1;i<=c;i++){
if(c%i==0&&check(i,c/i)==1) ans++;
}
printf("%d",ans);
return 0;
}