#include <bits/stdc++.h>
using namespace std;
char getc() {
  char c = getchar();
  while ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && (c < '0' || c > '9'))
    c = getchar();
  return c;
}
int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); }
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x * f;
}
int n, m, fac[1000010], inv[1000010], f[1000010], s[1000010], ans;
int A(int n, int m) {
  if (m > n) return 0;
  return 1ll * fac[n] * inv[n - m] % 1000000007;
}
void inc(int &x, int y) {
  x += y;
  if (x >= 1000000007) x -= 1000000007;
}
signed main() {
  n = read(), m = read();
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % 1000000007;
  inv[0] = inv[1] = 1;
  for (int i = 2; i <= n; i++)
    inv[i] =
        1000000007 - 1ll * (1000000007 / i) * inv[1000000007 % i] % 1000000007;
  for (int i = 2; i <= n; i++) inv[i] = 1ll * inv[i] * inv[i - 1] % 1000000007;
  for (int i = m + 1; i <= n; i++) {
    f[i] = ((i - m - 1ll + s[i - 1] - s[i - m - 1]) * fac[i - 2] % 1000000007 +
            1000000007) %
           1000000007;
    s[i] = (s[i - 1] + 1ll * f[i] * inv[i - 1]) % 1000000007;
  }
  for (int i = 1; i <= n; i++)
    inc(ans, 1ll * f[i] * A(n - 1, n - i) % 1000000007);
  cout << ans;
  return 0;
}
