import math import sys def main(): input = sys.stdin.read().split() N = int(input[0]) M = int(input[1]) max_n = max(N, M) sigma = [0] * (max_n + 2) # Precompute sigma for 1..max_n # Precompute the sum of divisors (σ) using a sieve approach for i in range(1, max_n + 1): for j in range(i, max_n + 1, i): sigma[j] += i sum_prev = 0 max_sum = 0 for x_current in range(1, N + 1): if x_current <= M: delta = sigma[x_current] else: delta = 0 sqrt_x = int(math.isqrt(x_current)) for i in range(1, sqrt_x + 1): if x_current % i == 0: j = x_current // i if i <= M: delta += i if j != i and j <= M: delta += j sum_prev += delta current_sum = x_current * M - sum_prev if current_sum > max_sum: max_sum = current_sum print(max_sum) if __name__ == "__main__": main()