#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF_LL (ll)1e18 #define INF (int)1e9 #define REP(i, n) for(int i = 0;i < (n);i++) #define FOR(i, a, b) for(int i = (a);i < (b);i++) #define all(x) x.begin(),x.end() using ll = long long; using PII = pair; const double eps = 1e-10; templateinline void chmin(A &a, B b){if(a > b) a = b;} templateinline void chmax(A &a, B b){if(a < b) a = b;} const ll mod = 1e9+7; ll fact[114514]; int main(void){ ll N, M; fact[0] = 1; cin >> N >> M; FOR(i, 1, 114514){ fact[i] = fact[i-1]*i%mod; } ll res = 0; FOR(i, 1, N+1){ if(i%M) continue; res += (N/M-1)*fact[N-2]%mod; res %= mod; } cout << res << endl; }