import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, std.bitmanip; immutable long MOD = 10^^9 + 7; void main() { auto s = readln.split.map!(to!long); auto N = s[0]; auto M = s[1]; auto X = N / M; if (X <= 1) { writeln(0); return; } long ans = (X - 1) * 2 % MOD; auto table = new bool[](N+1); for (long i = M * 2; i <= N; i += M) { long tmp = X - i / M; for (long j = i * 2; j <= N; j += i) { tmp -= 1; } ans += tmp * 2 % MOD; ans %= MOD; } foreach (i; 1..N-1) { ans = ans * i % MOD; } ans = (ans + MOD) % MOD; ans.writeln; }