#include #include #include #include #include #include #include #include using namespace std; long long n, m, mod = 1000000007; bool primes[100009]; long long prime(long long p) { long long R = p*p; for (int i = 2; i <= p; i++) { if (primes[i] == true)R -= 1LL*(p / i)*(p / i); } return R - 1; } int main() { for (int i = 2; i <= 100008; i++) primes[i] = true; for (int i = 2; i*i <= 100008; i++) { for (int j = i*i; j <= 100008; 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; }