#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, k, f[1000010], inv[1000010], sum, ans, nmod = 1;
int main() {
  scanf("%lld%lld", &n, &k);
  f[0] = 1;
  ans = n;
  for (int i = 1; i <= n; i++) {
    inv[i] = (-1 * (mod / i) * inv[mod % i] % mod + mod + (i == 1)) % mod;
    sum = (sum + f[i - 1]) % mod;
    if (i > k) sum = (sum - f[i - k - 1] + mod) % mod;
    f[i] = sum * inv[i] % mod;
    ans = (ans - f[i - 1] + mod) % mod;
    if (i != 1) nmod = nmod * (i - 1) % mod;
  }
  printf("%d\n", nmod * ans % mod);
}
