func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 100005;   const int P = 1e9 + 7;   const int inf = 1e9;   const long long Inf = 1e15;   inline int IN() {     char ch = getchar();     int x = 0, f = 0;     while (ch <  0  || ch >  9 ) ch = getchar(), f = (ch ==  - );     while (ch >=  0  && ch <=  9 ) {       x = (x << 1) + (x << 3) + ch - 48;       ch = getchar();     }     return f ? (-x) : x;   }   inline int Pow(int x, int y, int p) {     int an = 1;     for (; y; y >>= 1, x = (long long)x * x % p)       if (y & 1) an = (long long)an * x % p;     return an;   }   void renew(int &x, int y) {     x += y;     if (x < 0)       x += P;     else if (x >= P)       x -= P;   }   void setIO(string a) {     freopen((a +  .in ).c_str(),  r , stdin);     freopen((a +  .out ).c_str(),  w , stdout);   }   template <typename T>   inline void chkmin(T &a, const T &b) {     if (a > b) a = b;   }   template <typename T>   inline void chkmax(T &a, const T &b) {     if (a < b) a = b;   }   int n, k;   int dp[1000005], g[1000005], fac[1000005], inv[1000005];   int main() {     scanf( %d%d , &n, &k);     fac[0] = 1;     for (int i = (int)1; i <= (int)n; i++) fac[i] = (long long)fac[i - 1] * i % P;     inv[0] = inv[1] = 1;     for (int i = (int)2; i <= (int)n; i++)       inv[i] = (long long)inv[P % i] * (P - P / i) % P;     for (int i = (int)2; i <= (int)n; i++)       inv[i] = (long long)inv[i - 1] * inv[i] % P;     dp[1] = dp[0] = 1;     for (int i = (int)2; i <= (int)k; i++) dp[i] = (long long)dp[i - 1] * i % P;     for (int i = (int)1; i <= (int)k; i++)       g[i] = (g[i - 1] + (long long)inv[i] * dp[i]) % P;     for (int i = (int)k + 1; i <= (int)n; i++) {       dp[i] = (g[i - 1] + P - g[i - k - 1]) % P;       dp[i] = (long long)dp[i] * fac[i - 1] % P;       g[i] = (g[i - 1] + (long long)inv[i] * dp[i]) % P;     }     int ans = 0;     for (int i = (int)0; i <= (int)n - 1; i++)       ans = (ans + (long long)dp[i] * fac[n - 1] % P * inv[i]) % P;     ans = (0LL + fac[n] - ans) % P;     ans = (ans + P) % P;     printf( %d n , ans);     return 0;   }   