import sys input = sys.stdin.readline from collections import * A, B = map(int, input().split()) ans = 0 for d in range(1, int(A**0.5)+1): if d%B==0: ans += 1 if d!=A//d and (A//d)%B==0: ans += 1 print(ans)