#include <bits/stdc++.h>
using namespace std;
long long n, m, ans, p = 1e9 + 7, jie[1000010], ny[1000010], f[1000010],
                     g[1000010];
long long C(long long x, long long y) {
  return jie[x] * ny[x - y] % p * ny[y] % p;
}
long long ksm(long long x, long long y) {
  long long xlh = 1;
  while (y) {
    if (y & 1) xlh = xlh * x % p;
    x = x * x % p;
    y /= 2;
  }
  return xlh;
}
int main() {
  long long i, j;
  scanf("%lld%lld", &n, &m);
  jie[0] = 1;
  ny[0] = 1;
  for (i = 1; i <= n; i++) jie[i] = jie[i - 1] * i % p;
  for (i = 1; i <= n; i++) ny[i] = ksm(jie[i], p - 2);
  for (i = 1; i < n - m; i++) {
    g[i + m] =
        (jie[i + m - 1] - C(i + m - 1, i - 1) * f[i - 1] % p * jie[m] % p + p) %
        p;
    f[i] = (f[i - 1] * (i) % p + g[i]) % p;
  }
  for (i = 1; i < n; i++) {
    ans = (ans + g[i] * jie[n - i] % p * C(n - 1, i) % p) % p;
  }
  printf("%lld", ans);
}
