#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const unsigned gen_seed =
    std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937_64 gen(gen_seed);
long long gcd(long long a, long long b, long long& x, long long& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
long long invmod(long long a, long long modulo) {
  long long x, y;
  gcd(a, modulo, x, y);
  return (x % modulo + modulo) % modulo;
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  std::vector<long long> nfac(1, 1);
  std::vector<long long> ifac(1, 1);
  for (long long i = 1; i <= 2e6; i++) {
    nfac.push_back(nfac.back() * i % mod);
    ifac.push_back(invmod(nfac.back(), mod));
  }
  std::vector<long long> c(n + 1, 0);
  for (long long i = k + 1; i <= n; i++) {
    long long cmin =
        (c[i - 1] -
         ((nfac[i - 2] * ifac[i - k - 1]) % mod) * c[i - k - 1] % mod + mod) %
        mod;
    c[i] = ((i - 1) * cmin + c[i - 1] + nfac[i - 1]) % mod;
  }
  std::vector<long long> a(n + 1, 0);
  for (long long i = 2; i <= n; i++) {
    a[i] = ((i - 1) * a[i - 1] + c[i - 1]) % mod;
  }
  cout << a[n];
}
