a,b=map(int,input().split()) s=set() for i in range(1,int(a**0.5)+1): if a%i==0: s.add(i) s.add(a//i) ans=0 for c in s: if c%b==0: ans+=1 print(ans)