#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int n, m;
long long fact[1000010], inv[1000010], ans, f[1000010], sum;
inline int read() {
  int x = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return w ? -x : x;
}
long long ksm(long long B, long long K, long long A = 1) {
  for (; K; K >>= 1, B = B * B % mod)
    if (K & 1) A = A * B % mod;
  return A;
}
void prepare() {
  fact[0] = 1;
  for (int i = 1; i <= 1000000; i++) fact[i] = fact[i - 1] * i % mod;
  inv[1000000] = ksm(fact[1000000], mod - 2);
  for (int i = 1000000 - 1; i >= 0; i--) inv[i] = inv[i + 1] * (i + 1) % mod;
}
long long C(long long N, long long M) {
  if (N < M || M < 0) return 0;
  return fact[N] * inv[M] % mod * inv[N - M] % mod;
}
int main() {
  prepare();
  n = read();
  m = read();
  ans = fact[n];
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    (sum += f[i - 1] * inv[i - 1] % mod) %= mod;
    if (i - m >= 1) (sum -= f[i - m - 1] * inv[i - m - 1] % mod) %= mod;
    f[i] = sum * fact[i - 1] % mod;
    (ans -= f[i - 1] * C(n - 1, n - i) % mod * fact[n - i] % mod) %= mod;
  }
  cout << (ans + mod) % mod << '\n';
  return 0;
}
