n,m = map(int,input().split()) a = 0 for i in range(1,n+1): if n % i == 0 and i % m == 0: a += 1 print(a)