#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 5;
int add(int x, int y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
int mul(int x, int y) {
  long long z = 1LL * x * y;
  return z - z / mod * mod;
}
int p[maxn], inv[maxn], f[maxn];
int main() {
  int n, k, i, j;
  scanf("%d%d", &n, &k);
  p[0] = inv[0] = inv[1] = 1;
  for (i = 1; i <= n; i++) p[i] = mul(p[i - 1], i);
  for (i = 2; i <= n; i++) inv[i] = mul(mod - mod / i, inv[mod % i]);
  for (i = 2; i <= n; i++) inv[i] = mul(inv[i], inv[i - 1]);
  for (i = k + 1; i < n; i++)
    f[i] = add(mul(i, f[i - 1]), mul(add(p[i - k - 1], mod - f[i - k - 1]),
                                     mul(p[i - 1], inv[i - k - 1])));
  int ans = 0;
  for (i = k + 1; i < n; i++) {
    j = add(f[i], mod - mul(i, f[i - 1]));
    ans = add(ans, mul(mul(j, n - i), mul(p[n - 1], inv[i])));
  }
  printf("%d\n", ans);
  return 0;
}
