#include <bits/stdc++.h>
using namespace std;
int pw[1000050], ni[1000050], f[1000050], s[1000050], n, k, i, fk[1000050];
inline int qmi(int di, int zhi) {
  int ret = 1, x = di;
  while (zhi) {
    if (zhi & 1) ret = 1LL * ret * x % 1000000007;
    x = 1LL * x * x % 1000000007;
    zhi >>= 1;
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &k);
  pw[0] = 1;
  fk[1] = 1;
  for (i = 2; i <= n; i++)
    fk[i] = -1LL * (1000000007 / i) * fk[1000000007 % i] % 1000000007;
  for (i = 1; i <= n; i++) pw[i] = 1LL * pw[i - 1] * i % 1000000007;
  ni[n] = qmi(pw[n], 1000000007 - 2);
  for (i = n; i >= 1; i--) ni[i - 1] = 1LL * ni[i] * i % 1000000007;
  f[1] = 0;
  int ans = 0;
  for (i = 2; i <= n; i++) {
    f[i] = (0LL + (i - k - 1 > 0 ? i - k - 1 : 0) + s[i - 1] -
            s[i - k - 1 > 0 ? i - k - 1 : 0]) %
           1000000007;
    f[i] = 1LL * f[i] * fk[i - 1] % 1000000007;
    s[i] = (s[i - 1] + f[i]) % 1000000007;
    ans = (1LL * f[i] * pw[n - 1] % 1000000007 + ans) % 1000000007;
  }
  printf("%d\n", (ans + 1000000007) % 1000000007);
  return 0;
}
