import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) def make_divisors(n): divisors = [] for i in range(1, int(n ** 0.5) + 1): if n % i == 0: divisors.append(i) divisors.append(n // i) return divisors n, k = map(int, read().split()) k = make_divisors(k) print(sum(max(x - 1 if n >= x else 2 * n + 1 - x, 0) * max(y - 1 if n >= y else 2 * n + 1 - y, 0) * (2 if x != y else 1) for x, y in zip(k[::2], k[1::2])))