#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long quickpow(long long p, long long k) {
  long long ans = 1;
  while (k) {
    if (k & 1) ans = (ans * p) % mod;
    p = (p * p) % mod;
    k >>= 1;
  }
  return ans;
}
long long n, k;
long long sum[1000005], fac[1000005], inv[1000005];
int main() {
  scanf("%I64d%I64d", &n, &k);
  fac[0] = 1;
  for (long long i = 1; i <= n; i++) {
    fac[i] = (fac[i - 1] * i) % mod;
    inv[i] = quickpow(fac[i], mod - 2);
  }
  long long ans = 0;
  for (long long i = k + 2; i <= n; i++) {
    long long now = 0;
    now += ((i - k - 1) * fac[i - 2]) % mod;
    now += (((sum[i - 1] - sum[i - k - 1]) * fac[i - 2]) % mod + mod) % mod;
    sum[i] = (sum[i - 1] + now * inv[i - 1]) % mod;
    ans += (((now * fac[n - 1]) % mod) * inv[i - 1]) % mod;
    ans %= mod;
  }
  printf("%I64d\n", ans);
}
