#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
const long long P = 1000000007;
int n, m;
long long jc[maxn], ine[maxn], jcc[maxn], f[maxn], s[maxn];
int main() {
  scanf("%d%d", &n, &m);
  int i;
  ine[0] = ine[1] = jc[0] = jc[1] = jcc[0] = jcc[1] = 1;
  for (i = 2; i <= n; i++)
    jc[i] = jc[i - 1] * i % P, ine[i] = P - (P / i) * ine[P % i] % P,
    jcc[i] = jcc[i - 1] * ine[i] % P;
  for (i = m + 2; i <= n; i++)
    f[i] = (i - m - 1 + s[i - 1] - s[i - m - 1] + P) * jc[i - 2] % P,
    s[i] = (s[i - 1] + f[i] * jcc[i - 1]) % P;
  printf("%I64d", s[n] * jc[n - 1] % P);
  return 0;
}
