using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, m) = (c[0], c[1]); var dp = new long[n + 1]; for (var i = 1; i <= n; ++i) dp[i] = i * (m - 1L); var cum = new long[n + 1]; for (var i = 2; i <= m; ++i) { for (var j = i; j <= n; j += i) cum[j] -= i; } for (var i = 2; i <= n; ++i) cum[i] += cum[i - 1]; for (var i = 1; i <= n; ++i) dp[i] += cum[i]; WriteLine(dp.Max()); } }