#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long n, k, sum1, sum2, inv[3000011], mi, g[3000001];
int main() {
  cin >> n >> k;
  sum2 = n;
  g[0] = mi = 1;
  for (long long i = 1; i <= n; i++) {
    inv[i] = (-1 * (mod / i) * inv[mod % i] % mod + mod + (i == 1)) % mod;
    sum1 = (sum1 + g[i - 1]) % mod;
    if (i > k) sum1 = (sum1 - g[i - k - 1] + mod) % mod;
    g[i] = sum1 * inv[i] % mod;
    sum2 = (sum2 - g[i - 1] + mod) % mod;
    if (i != 1) mi = (mi * (i - 1)) % mod;
  }
  cout << mi * sum2 % mod;
}
