#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long *fact_deg;
void calc_degrees(long long n, long long k) {
  fact_deg = new long long[n + 1];
  stack<pair<long long, long long> > st1, st2;
  st1.push(make_pair(1, 1));
  for (long long i = 2; i <= k; i++) {
    st1.push(make_pair(i, (st1.top().second * i) % mod));
  }
  for (long long i = 1; i <= n; i++) {
    fact_deg[i] = 1;
    if (!st1.empty()) fact_deg[i] = (fact_deg[i] * st1.top().second) % mod;
    if (!st2.empty()) fact_deg[i] = (fact_deg[i] * st2.top().second) % mod;
    if (st1.empty())
      st1.push(make_pair(i + k, i + k));
    else
      st1.push(make_pair((i + k), (st1.top().second * (i + k)) % mod));
    if (st2.empty()) {
      st2.push(make_pair(st1.top().first, st1.top().first));
      st1.pop();
      while (!st1.empty()) {
        st2.push(make_pair(st1.top().first,
                           (st2.top().second * st1.top().first) % mod));
        st1.pop();
      }
    }
    st2.pop();
  }
}
long long fact_degree(long long m, long long n) {
  long long ans = 1;
  for (long long i = 0; i < n; i++) {
    ans *= (m + i);
    ans %= mod;
  }
  assert(ans == fact_deg[m]);
  return ans;
}
int main() {
  long long n, k;
  cin >> n >> k;
  long long *dp = new long long[n + 2], sum = 1, f_sum = 1;
  dp[1] = 1;
  if (n >= k) calc_degrees(n - k + 1, k);
  for (long long i = 2; i <= n; i++) {
    dp[i] = sum;
    f_sum = f_sum * (i - 1) + dp[i];
    f_sum %= mod;
    sum = sum * (i - 1) + dp[i];
    sum %= mod;
    if (i > k) sum = sum - fact_deg[i - k] * dp[i - k] + mod * mod;
    sum %= mod;
  }
  long long fact = 1;
  for (long long i = 1; i <= n; i++) fact = (fact * i) % mod;
  long long ans = (mod + fact - f_sum) % mod;
  cout << ans;
  return 0;
}
int __main1() {
  long long n, k;
  cin >> n >> k;
  long long **dp = new long long *[n + 2];
  dp[1] = new long long[2];
  dp[1][1] = 1;
  for (long long i = 2; i <= n; i++) {
    dp[i] = new long long[i + 1];
    dp[i][i] = 0;
    for (long long j = max(i - k, (long long)1); j < i; j++) {
      dp[i][i] += dp[i - 1][j];
      dp[i][i] %= mod;
    }
    for (long long j = 1; j < i; j++) {
      dp[i][j] = dp[i - 1][j] * (i - 1);
      dp[i][j] %= mod;
    }
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    ans += dp[n][i];
    ans %= mod;
  }
  long long fact = 1;
  for (long long i = 1; i <= n; i++) fact = (fact * i) % mod;
  ans = (mod + fact - ans) % mod;
  cout << ans;
  return 0;
}
int __test() {
  clock_t t = clock();
  main();
  cout << endl;
  cout << "TIME\t" << (clock() - t);
  return 0;
}
