#include #include #include #include #include #include #include #include using namespace std; long long n, m, mod = 1000000007; bool primes[1000009]; long long prime(long long p) { if (p == 0) return 0; long long R = p*p; for (int i = 2; i <= p; i++) { if (primes[i] == true) { long long G = p / i; R -= 1LL * G*G; } } return R - 1; } int main() { for (int i = 2; i <= 1000008; i++) primes[i] = true; for (int i = 2; i*i <= 1000008; i++) { for (int j = i*i; j <= 1000008; j += i) primes[j] = false; } cin >> n >> m; long long G = prime(n / m); long long ret = 1; for (int i = 1; i <= n - 2; i++) { ret *= i; ret %= mod; } ret *= (G % mod); ret %= mod; cout << ret << endl; return 0; }