Problem: We have N lamps numbered 1 to N, and N buttons numbered 1 to N. Initially, Lamp 1, 2, \cdots, A are on, and the other lamps are off.

Snuke and Ringo will play the following game.

* First, Ringo generates a permutation (p_1,p_2,\cdots,p_N) of (1,2,\cdots,N). The permutation is chosen from all N! possible permutations with equal probability, without being informed to Snuke.

* Then, Snuke does the following operation any number of times he likes:

* Choose a lamp that is on at the moment. (The operation cannot be done if there is no such lamp.) Let Lamp i be the chosen lamp. Press Button i, which switches the state of Lamp p_i. That is, Lamp p_i will be turned off if it is on, and vice versa.



At every moment, Snuke knows which lamps are on. Snuke wins if all the lamps are on, and he will surrender when it turns out that he cannot win. What is the probability of winning when Snuke plays optimally?

Let w be the probability of winning. Then, w \times N! will be an integer. Compute w \times N! modulo (10^9+7).

Constraints

* 2 \leq N \leq 10^7
* 1 \leq A \leq \min(N-1,5000)

Input

Input is given from Standard Input in the following format:


N A


Output

Print w \times N! modulo (10^9+7), where w is the probability of Snuke's winning.

Examples

Input

3 1


Output

2


Input

3 2


Output

3


Input

8 4


Output

16776


Input

9999999 4999


Output

90395416

Solution (in CPP):

Solution:
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

const int mod = (int) 1e9 + 7;

int mul(int a, int b) {
  return (long long) a * b % mod;
}

void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

const int maxn = (int) 1e7 + 5, maxa = 5005;
int f[maxn], inv[maxn], finv[maxn];

void precalc() {
  f[0] = 1;
  for (int i = 1; i < maxn; i++) {
    f[i] = mul(f[i - 1], i);
  }
  inv[1] = 1;
  for (int i = 2; i < maxn; i++) {
    inv[i] = (mod - (long long) (mod / i) * inv[mod % i] % mod) % mod;
  }
  finv[0] = 1;
  for (int i = 1; i < maxn; i++) {
    finv[i] = mul(finv[i - 1], inv[i]);
  }
}

int n, a;

bool read() {
  if (scanf("%d%d", &n, &a) < 2) {
    return false;
  }
  return true;
}

int dp[maxa][maxa];
int cnt[maxa][maxa];

void solve() {
  for (int j = 0; j <= a; j++) {
    cnt[a][j] = 0;
  }
  for (int i = a - 1; i >= 0; i--) {
    for (int j = 0; i + j <= a; j++) {
      auto &cur = cnt[i][j];
      if (!j) {
        cur = mul(f[n - i - 1], finv[a - i - 1]);
        continue;
      }
      cur = cnt[i][j - 1];
      add(cur, mod - cnt[i + 1][j - 1]);
    }
  }
  memset(dp, 0, sizeof(dp));
  add(dp[a][0], f[a]);
  add(dp[a - 1][0], mod - f[a]);
  int res = 0;
  for (int i = a; i >= 0; i--) {
    for (int j = 0; j <= a; j++) {
      {
        auto &cur = dp[i][j];
        add(cur, dp[i + 1][j]);
        if (!cur) {
          continue;
        }
      }
      auto cur = dp[i][j];
      cur = mul(cur, finv[i]);
      int val = mul(cur, f[max(0, i - 1)]);
      add(res, mul(val, cnt[i][j]));
      if (!i) {
        continue;
      }
      add(dp[i - 1][j + 1], val);
      if (i >= 2) {
        add(dp[i - 2][j + 1], mod - val);
        add(dp[i - 2][j], val);
      }
    }
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}