#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
long long fact[1000005], revfact[1000005], dp[1000005], pref[1000005];
long long binpow(long long a, int step) {
  if (step == 0) return 1ll;
  if (step % 2 == 0) {
    long long t = binpow(a, step / 2);
    return t * t % MOD;
  } else
    return binpow(a, step - 1) * a % MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  fact[0] = 1;
  for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * (long long)i % MOD;
  revfact[n] = binpow(fact[n], MOD - 2);
  for (int i = n - 1; i >= 0; i--)
    revfact[i] = revfact[i + 1] * (long long)(i + 1) % MOD;
  for (int i = 1; i <= n; i++) {
    if (i <= k)
      dp[i] = pref[i - 1] * fact[i - 1] % MOD;
    else {
      dp[i] = (pref[i - 1] - pref[i - k - 1] + MOD) * fact[i - 1] % MOD;
      dp[i] = (dp[i] + fact[i - 1] * (long long)(i - k)) % MOD;
    }
    pref[i] = (pref[i - 1] + dp[i] * revfact[i]) % MOD;
  }
  long long ans = (pref[n - 1] * fact[n - 1]) % MOD;
  cout << ans;
  return 0;
}
