#include <bits/stdc++.h>
using namespace std;
namespace FGF {
int n, m;
const int mo = 1e9 + 7;
const int N = 1e6 + 5;
long long fac[N], inv[N], f[N], sum[N], ans;
void work() {
  scanf("%d%d", &n, &m);
  fac[0] = inv[0] = inv[1] = 1;
  for (int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % mo;
  for (int i = 2; i <= n; i++) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
  for (int i = 2; i <= n; i++) inv[i] = inv[i] * inv[i - 1] % mo;
  f[0] = 1;
  for (int i = 1; i <= m; i++)
    f[i] = fac[i], sum[i] = (sum[i - 1] + f[i] * inv[i] % mo) % mo;
  for (int i = m + 1; i <= n; i++) {
    f[i] = (sum[i - 1] - sum[i - m - 1] + mo) * fac[i - 1] % mo;
    sum[i] = (sum[i - 1] + f[i] * inv[i] % mo) % mo;
  }
  ans = fac[n];
  for (int i = 1; i <= n; i++)
    ans = (ans - f[i - 1] * fac[n - 1] % mo * inv[i - 1] % mo + mo) % mo;
  printf("%lld", ans);
}
}  // namespace FGF
int main() {
  FGF::work();
  return 0;
}
