#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long fact[1000009];
long long f[1000009];
long long F[1000009];
long long pow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b % 2) ans = (ans * a) % MOD;
    a = (a * a) % MOD;
    b /= 2;
  }
  return ans;
}
long long inv(long long a) { return pow(a, MOD - 2); }
int main() {
  fact[0] = 1;
  for (int v = 1; v <= 1000001; v++)
    fact[v] = ((fact[v - 1]) * (long long)v) % MOD;
  int n, k;
  scanf("%d %d", &n, &k);
  f[1] = 1;
  F[1] = 1;
  for (int i = 1; i <= 1000000; i++) {
    f[i + 1] = (fact[i - 1] * (F[i] + MOD - (i - k >= 0 ? F[i - k] : 0))) % MOD;
    F[i + 1] = (F[i] + f[i + 1] * inv(fact[i])) % MOD;
  }
  long long ans = 0;
  for (int m = 0; m <= n - k - 2; m++) {
    long long tmp = fact[n - 1];
    tmp = (tmp * inv(fact[m + k + 1])) % MOD;
    tmp = (tmp * inv(fact[n - 1 - m - k - 1])) % MOD;
    tmp = (tmp * fact[m + k]) % MOD;
    tmp = (tmp * inv(fact[m])) % MOD;
    tmp = (tmp * f[m + 1]) % MOD;
    tmp = (tmp * fact[n - m - k - 1]) % MOD;
    ans = (ans + tmp) % MOD;
  }
  cout << ans << endl;
}
