#約数を求める def makeDivisor(n): divisors = [] for i in range(1, int(n ** 0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) divisors.sort() return divisors N = int(input()) K = int(input()) a = makeDivisor(K) if K < 4: print(0) exit() a.pop(0) a.pop() ans = 0 for i in range(len(a)): x = a[i] if x <= N + 1: cnt1 = x - 1 elif N + 2 <= x <= 2 * N: cnt1 = 2 * N + 1 - x else: cnt1 = 0 y = a[len(a)-1-i] if y <= N + 1: cnt2 = y - 1 elif N + 2 <= y <= 2 * N: cnt2 = 2 * N + 1 - y else: cnt2 = 0 ans += cnt1 * cnt2 print(ans)