def get_divisors(n: int) -> list: lower_divisors, upper_divisors = [], [] for i in range(1, int(n**0.5)+1): if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) return lower_divisors + upper_divisors[::-1] a, b = map(int, input().split()) div = get_divisors(a) print(sum(1 for a in div if a % b == 0))