#include <bits/stdc++.h>
using namespace std;
long long dp[2 * 1000000 + 5];
long long A[2 * 1000000 + 5];
const long long MOD = 1e9 + 7;
long long N[2 * 1000000 + 5];
long long pows(long long a, long long b) {
  long long ans = 1;
  a %= MOD;
  while (b) {
    if (b & 1) ans = (ans * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return ans % MOD;
}
int main() {
  int n, k;
  memset(dp, 0, sizeof(dp));
  cin >> n >> k;
  A[0] = 1;
  memset(N, 0, sizeof(N));
  for (int i = 1; i < 1000001; i++) {
    A[i] = (A[i - 1] * i) % MOD;
  }
  for (int i = k + 1; i <= n; i++) {
    dp[i] = (A[i - 2] * (i - k - 1) % MOD +
             (A[i - 2] * (N[i - 1] - N[i - k - 1] + MOD) % MOD) % MOD) %
            MOD;
    N[i] = (N[i - 1] % MOD + (dp[i] * (pows(A[i - 1], MOD - 2))) % MOD) % MOD;
  }
  long long SUM = 0;
  for (int i = k + 1; i <= n; i++) {
    SUM =
        SUM +
        ((((dp[i] * A[n - 1]) % MOD) * (pows(A[i - 1], MOD - 2)) % MOD) % MOD) %
            MOD;
    SUM = SUM % MOD;
  }
  cout << (SUM + MOD) % MOD << endl;
  return 0;
}
