#include <bits/stdc++.h>
using namespace std;
const int md = 1e9 + 7;
int n, k;
long long f[1234567], inv[1234567], s[1234567], g[1234567], ans;
long long pw(long long a, int b) {
  if (b == 0) return 1;
  long long tmp = pw(a, b / 2);
  tmp = tmp * tmp % md;
  if (b % 2) tmp = tmp * a % md;
  return tmp;
}
int main() {
  scanf("%d%d", &n, &k);
  f[0] = inv[0] = 1;
  for (int i = 1; i <= n; ++i) f[i] = f[i - 1] * i % md;
  inv[n] = pw(f[n], md - 2);
  for (int i = n - 1; i > 0; --i) inv[i] = inv[i + 1] * (i + 1) % md;
  for (int i = 1; i <= n; ++i) {
    if (k >= i) continue;
    g[i] = f[i - 2] * (i - k - 1) % md +
           (s[i - 1] - s[i - k - 1]) * f[i - 2] % md + md;
    s[i] = (g[i] % md * inv[i - 1] % md + s[i - 1]) % md;
  }
  for (int i = 1; i <= n; ++i)
    ans = (ans + g[i] * f[n - 1] % md * inv[i - 1] % md) % md;
  printf("%I64d", ans);
  return 0;
}
