#include <bits/stdc++.h>
const int N = 1e6 + 5;
const long long MOD = 1e9 + 7;
long long qpow(long long x, long long y) {
  if (!y) return 1;
  long long t = qpow(x, y >> 1);
  if (y & 1) return t * t % MOD * x % MOD;
  return t * t % MOD;
}
long long inv[N], dp[N], p[N];
int C(int m, int n) { return p[m] * inv[n] % MOD * inv[m - n] % MOD; }
int main() {
  dp[0] = p[0] = 1;
  for (int i = 1; i < N; ++i) p[i] = p[i - 1] * i % MOD;
  inv[N - 1] = qpow(p[N - 1], MOD - 2);
  for (int i = N - 2; i >= 0; --i) inv[i] = inv[i + 1] * (i + 1) % MOD;
  int n, m, sum = 1;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    dp[i] = p[i - 1] * sum % MOD, sum = (sum + dp[i] * inv[i] % MOD) % MOD;
    if (i >= m) sum = (sum - dp[i - m] * inv[i - m] % MOD) % MOD;
  }
  int ans = p[n];
  for (int i = 1; i <= n; ++i)
    ans = (ans - dp[i - 1] * C(n - 1, n - i) % MOD * p[n - i] % MOD) % MOD;
  printf("%d", (ans + MOD) % MOD);
  return 0;
}
