#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10, mod = 1e9 + 7;
int n, k, alive[N], nerd[N], fc[N], ifc[N], dp[N], ans;
int power(int a, int b) {
  if (!b) return 1;
  int rtr = power(a, b / 2);
  if (b % 2) return 1ll * rtr * rtr % mod * a % mod;
  return 1ll * rtr * rtr % mod;
}
void Pre() {
  fc[0] = ifc[0] = 1;
  for (int i = 1; i < N - 4; i++)
    fc[i] = 1ll * fc[i - 1] * i % mod, ifc[i] = power(fc[i], mod - 2);
}
int ch(int x, int y) {
  if (x > y) return 0;
  return 1ll * fc[y] * ifc[x] % mod * ifc[y - x] % mod;
}
int main() {
  cin >> n >> k;
  Pre();
  alive[0] = 1;
  for (int i = 1; i < n; i++) {
    if (i >= k)
      nerd[i] = 1ll * alive[i - k] * ch(i - k, i - 1) % mod * fc[k - 1] % mod;
    alive[i] =
        ((1ll * alive[i - 1] * i % mod - 1ll * nerd[i - 1] * (i - 1) % mod) +
         mod) %
        mod;
    dp[i] = 1ll * nerd[i - 1] * (i - 1) % mod;
    ans =
        1ll * (ans + 1ll * dp[i] * ch(i, n - 1) % mod * fc[n - i] % mod) % mod;
  }
  cout << ans;
  return 0;
}
