#include <bits/stdc++.h>
using namespace std;
int const N = 1000003;
int const P = 1e9 + 7;
long long f[N], dp[N], sum[N];
int n, k;
long long inv(long long n, long long m) {
  long long ret = 1;
  while (m) {
    if (m & 1) ret = ret * n % P;
    n = n * n % P;
    m >>= 1;
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &k);
  f[0] = 1;
  for (int i = 1; i <= n; i++) f[i] = f[i - 1] * i % P;
  for (int i = 1; i <= n; i++) {
    if (i > k)
      dp[i] = ((i - k - 1) * f[i - 2] +
               f[i - 2] * (sum[i - 1] - sum[i - k - 1]) % P + P) %
              P;
    sum[i] = (sum[i - 1] + dp[i] % P * inv(f[i - 1], P - 2)) % P;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    ans = (ans + f[n - 1] * inv(f[i - 1], P - 2) % P * dp[i]) % P;
  printf("%lld\n", ans);
  return 0;
}
