#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long OO = 1e18;
const int N = 1e6 + 100;
const int mod = 1e9 + 7;
int gi() {
  int w = 0;
  bool q = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') q = 0, c = getchar();
  while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar();
  return q ? w : -w;
}
int f[N], s[N], fac[N], inv[N];
int main() {
  int n = gi(), m = gi(), i, ans = 0;
  for (i = fac[0] = 1; i <= n; i++) fac[i] = 1LL * fac[i - 1] * i % mod;
  for (i = 2, inv[0] = inv[1] = 1; i <= n; i++)
    inv[i] = -1LL * (mod / i) * inv[mod % i] % mod;
  for (i = 3; i <= n; i++) inv[i] = 1LL * inv[i - 1] * inv[i] % mod;
  for (i = m + 2; i <= n; i++) {
    f[i] = (1LL * fac[i - 2] * (i - m - 1) +
            1LL * (s[i - 1] - s[i - m - 1]) * fac[i - 2]) %
           mod;
    s[i] = (s[i - 1] + 1LL * f[i] * inv[i - 1]) % mod;
    ans = (ans + 1LL * f[i] * fac[n - 1] % mod * inv[i - 1]) % mod;
  }
  printf("%d\n", (ans + mod) % mod);
  return 0;
}
