N = int(input()) K = int(input()) def rem(x): return x-1-2*(x-1-N)*(x-2>=N)+(x-1-2*N)*(x-2>=2*N) X = 0 p = 1 while p * p < K: if K % p == 0: X += rem(p) * rem(K//p) p += 1 print(2*X+(p*p==K)*rem(p-1)*rem(p-1))