#include #include #include #include #include #include #include #include #include #include using namespace std; #define int long long int MOD = 1000000007; const int N = 1000000; int eulerPhi(int n) { static int lookup = 0, p[N], f[N]; if (!lookup) { for (int i = 0; i < N; i++) p[i] = 1, f[i] = i; for (int i = 2; i < N; ++i) { if (p[i]) { f[i] -= f[i] / i; for (int j = i + i; j < N; j += i) p[j] = 0, f[j] -= f[j] / i; } } lookup = 1; } return f[n]; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int N, M; cin >> N >> M; vector A(N); int res = 0; for (int i = 2; i <= N / M; i++) { res = (res + eulerPhi(i)) % MOD; } res = (res * 2) % MOD; for (int i = 1; i <= N - 2; i++) { res = (res * i) % MOD; } cout << res << endl; }