n = int(input())
k = int(input())

def make_divisors(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

div = make_divisors(k)
ans = 0
for i in range((1+len(div))//2):
    ac,bd = div[i],div[len(div)-i-1]
    #print(ac,bd,ans)
    if ac > 2*n or bd > 2*n:
        continue
    if ac > n:
        acn = (n-(ac-n))+1
    else:
        acn = ac-1
    if bd > n:
        bdn = (n-(bd-n))+1
    else:
        bdn = bd-1
    #print(acn,bdn,"acbd",ac,bd)
    if ac == bd:
        ans += acn*bdn
    else:
        ans += acn*bdn*2

print(ans)