#include <bits/stdc++.h>
const int MAXN = 1000000;
const long long P = 1e9 + 7;
using namespace std;
int fastPow(int b, int p) {
  int ret = 1;
  while (p) {
    if (p & 1) ret = 1LL * ret * b % P;
    b = 1LL * b * b % P;
    p >>= 1;
  }
  return ret;
}
int n, k;
long long dp[MAXN + 5], g[MAXN + 5], pre[MAXN + 5], ans;
long long fac[MAXN + 5], inv[MAXN + 5], inv_fac[MAXN + 5];
void init() {
  cin >> n >> k;
  inv[1] = 1, inv_fac[0] = fac[0] = 1;
  for (int i = 2; i <= n; ++i) inv[i] = (P - P / i) * inv[P % i] % P;
  for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i % P;
  for (int i = 1; i <= n; ++i) inv_fac[i] = inv_fac[i - 1] * inv[i] % P;
}
int main() {
  init();
  dp[0] = dp[1] = 1, pre[1] = 1, pre[2] = 2;
  for (int i = 2; i <= k; ++i) {
    long long g = pre[i];
    dp[i] = fac[i - 1] * g % P;
    pre[i + 1] = (pre[i] + dp[i] * inv_fac[i]) % P;
  }
  for (int i = k + 1; i <= n; ++i) {
    long long g = (pre[i] - pre[i - k + 1 - 1] + P) % P;
    dp[i] = fac[i - 1] * g % P;
    pre[i + 1] = (pre[i] + dp[i] * inv_fac[i]) % P;
  }
  long long ans = fac[n];
  ans = (ans - fac[n - 1] * pre[n] % P + P) % P;
  cout << ans % P << endl;
  return 0;
}
