a,b = map(int,input().split()) ans = set() for i in range(1,10**5): if a%i: continue if i%b == 0: ans.add(i) x = a//i if x%b == 0: ans.add(x) print(len(ans))