func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 4, Mod = 1e9 + 7;   struct Mint {     int res;     Mint() { res = 0; }     Mint(int a) : res(a) {}     friend Mint operator+(Mint A, Mint B) {       return Mint((A.res + B.res >= Mod) ? (A.res + B.res - Mod)                                          : (A.res + B.res));     }     friend Mint& operator+=(Mint& A, Mint B) { return A = A + B; }     friend Mint operator-(Mint A, Mint B) {       B.res = Mod - B.res;       return A + B;     }     friend Mint operator-(Mint A) { return Mint(Mod - A.res); }     friend Mint operator+(Mint A) { return A; }     friend Mint& operator-=(Mint& A, Mint B) { return A = A - B; }     friend Mint operator*(Mint A, Mint B) { return 1ll * A.res * B.res % Mod; }     friend Mint& operator*=(Mint& A, Mint B) { return A = A * B; }     friend Mint operator~(Mint A) {       static Mint res;       res = Mint(1);       static int k;       k = Mod - 2;       for (; k; k >>= 1, A *= A) (k & 1) && (res = res * A, 0);       return res;     }     friend Mint operator/(Mint A, Mint B) { return A * (~B); }     friend Mint& operator/=(Mint& A, Mint B) { return A *= (~B); }     friend Mint operator>>(Mint A, Mint B) { return Mint(A.res / B.res); }     friend Mint& operator>>=(Mint& A, Mint B) { return A = A >> B; }   };   Mint fac[N], ifac[N];   inline Mint C(int n, int k) { return fac[n] * ifac[n - k] * ifac[k]; }   int n, k;   Mint dp[N], pre[N];   int main() {     scanf( %d%d , &n, &k);     fac[0] = Mint(1);     for (register int i = (1); i <= (n); ++i) fac[i] = fac[i - 1] * Mint(i);     ifac[n] = ~fac[n];     for (register int i = (n - 1); i >= (0); --i)       ifac[i] = ifac[i + 1] * Mint(i + 1);     dp[0] = pre[0] = Mint(1);     for (register int i = (1); i <= (n - 1); ++i)       dp[i] =           (pre[i - 1] - ((i - k > 0) ? pre[i - k - 1] : Mint(0))) * fac[i - 1],       pre[i] = pre[i - 1] + dp[i] * ifac[i];     Mint res;     for (register int i = (1); i <= (n); ++i)       res += dp[i - 1] * fac[n - i] * C(n - 1, n - i);     printf( %d n , (fac[n] - res).res);     return 0;   }   