#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using int32 = std::int_fast32_t; using int64 = std::int_fast64_t; using uint32 = std::uint_fast32_t; using uint64 = std::uint_fast64_t; #define MOD ((uint64)1000000007) std::vector prime; int64 c(uint64 num) { uint64 ret = 0; for (uint32 i = 0;i < prime.size();++i) { while (num%prime[i] == 0) { num /= prime[i]; ++ret; } if (num == 1) break; } return ((ret & 1) ? (int64)-1 : (int64)1); } int main(void) { std::ios::sync_with_stdio(false); std::cin.tie(0); uint64 n, m; std::cin >> n >> m; if (m > n) { std::cout << "0\n"; return 0; } uint64 f = 1; for (uint64 i = 1;i < n-1;++i) { (f *= i) %= MOD; } std::vector ch(n + 1, 1); for (uint32 i = 2;i <= n;++i) { if (ch[i]) { prime.push_back((uint64)i); for (uint32 j = i;j <= n;j += i) { ch[j] = 0; } } } uint64 ans = 0; uint64 temp; for (uint64 i = 1;i <= n;++i) { if (i*m > n) break; temp = n / (i*m); ans = (ans + MOD + ((temp*(temp - 1) % MOD)*c(i))) % MOD; } (ans *= f) %= MOD; std::cout << ans << "\n"; return 0; }