#include using namespace std; int N, M, mobius[100009], mod = 1000000007; long long solve(long long x) { fill(mobius, mobius + x + 1, 1); for(int i = 2; i <= x; i++) { for(int j = i; j <= x; j += i) mobius[j] *= -1; if(i * i <= x) for(int j = i * i; j <= x; j += i * i) mobius[j] = 0; } long long ret = 0; for(int i = 1; i <= x; i++) ret += 1LL * mobius[i] * (x / i) * (x / i); return ret; } int main() { cin >> N >> M; int ret = (solve(N / M) - 1) % mod; for(int i = 1; i <= N - 2; i++) ret = 1LL * ret * i % mod; cout << ret << endl; return 0; }