def make_divisors(N):#約数列挙O(√N) lower_divisors , upper_divisors = [], [] i = 1 while i*i <= N: if N % i == 0: lower_divisors.append(i) if i != N // i: upper_divisors.append(N//i) i += 1 return lower_divisors + upper_divisors[::-1] N = int(input()) K = int(input()) if 4 >= K: print(0) exit() div = make_divisors(K) ans = 0 for d in div: if d == 1 or d == K: continue d1 = d d2 = K//d if d1 % 2 == 2: cnt1 = max(0,min((N-d1//2)*2+1,d1-1)) else: cnt1 = max(0,min((N-d1//2)*2,d1-1)) if d2 % 2 == 2: cnt2 = max(0,min((N-d2//2)*2+1,d2-1)) else: cnt2 = max(0,min((N-d2//2)*2,d2-1)) ans += cnt1*cnt2 print(ans)