#include #include #include #include using namespace std; #define MOD (int)(1e9+7) int solve(int N,int M) { long long cnt = N / M; long long ans = 0; for (int i = 1; i <= cnt; i++) { ans += 2 * (cnt - i); int x = i; for (int j = 2; j*j <= x; j++) { if (x%j == 0) { ans -= 2 * ((cnt - i) / j); while (x%j == 0)x /= j; } } if (x != 1) { ans -= 2 * ((cnt - i) / x); } } ans %= MOD; for (int i = N - 2; i >= 1; i--) { ans *= i; ans %= MOD; } return ans; } int main() { int N, M; cin >> N >> M; cout << solve(N, M) << endl; return 0; }