A, B = map(int, input().split()) print(sum([(A % k == 0 and k % B == 0) for k in range(1, A+1)]))