#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const int M = 1e6 + 10;
long long int dp[M], part[M], ans, fac[M], n, k;
long long int pw(long long int a, long long int b) {
  if (b == 0ll) return 1ll;
  long long int p = pw(a, b / 2);
  (p *= p) %= MOD;
  if (b % 2) return (p * a) % MOD;
  return p;
}
int main() {
  fac[0] = 1;
  for (int i = 1; i < M; i++) (fac[i] = fac[i - 1] * i) %= MOD;
  cin >> n >> k;
  for (int i = k + 1; i <= n; i++) {
    (dp[i] = (i - k - 1) * fac[i - 2]) %= MOD;
    (dp[i] += (part[i - 1] - part[i - k - 1] + MOD) * fac[i - 2]) %= MOD;
    (part[i] = part[i - 1] + dp[i] * pw(fac[i - 1], MOD - 2)) %= MOD;
  }
  cout << (part[n] * fac[n - 1]) % MOD << endl;
  return 0;
}
