def divisor_list(N): #約数のリスト if N == 1: return [1] res = [] for i in range(1,N): if i*i >= N: break if N%i == 0: res.append(i) if i*i == N: res.append(i) return sorted(res) n = int(input()) k = int(input()) def f(d,n): if d < 0: return 0 r = (d+1) if d >= n: r -= 2*(d-n+1) if d >= 2*n: r += (d-2*n+1) return r ans = 0 for d in divisor_list(k): r = f(d-2,n)*f(k//d-2,n) ans += 2*r if d*d != n else r print(ans)