#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long fac[1000010], inv[1000010], dp[1000010];
inline long long pow2(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return res;
}
inline long long getInv(long long x) { return pow2(x, mod - 2); }
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  fac[0] = 1;
  inv[0] = 1;
  for (int i = 1; i <= n; i++) {
    fac[i] = fac[i - 1] * i % mod;
    inv[i] = getInv(fac[i]);
  }
  long long sum = 0;
  for (int i = 2; i <= n + 1; i++) {
    if (i - k - 1 >= 1)
      sum = (sum + mod - dp[i - k - 1] * inv[i - k - 2] % mod) % mod;
    dp[i] = ((long long)max((i - k - 1), 0) * fac[i - 2] % mod +
             sum * fac[i - 2] % mod) %
            mod;
    sum = (sum + dp[i] * inv[i - 1] % mod) % mod;
  }
  long long ans = 0;
  for (int i = 2; i <= n; i++) {
    ans = (ans + dp[i] * fac[n - 1] % mod * inv[i - 1]) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
