#include <bits/stdc++.h>
using namespace std;
const int N = 2010, mod = 1e9 + 7;
int n, m;
long long jc[N], inv[N], f[N][N][4], ans;
long long C(int x, int y) { return jc[x] * inv[y] % mod * inv[x - y] % mod; }
int main() {
  scanf("%d %d", &n, &m);
  jc[0] = inv[0] = inv[1] = 1;
  for (int i = 2; i <= n; i++) inv[i] = inv[mod % i] * (mod - mod / i) % mod;
  for (int i = 1; i <= n; i++)
    jc[i] = jc[i - 1] * i % mod, inv[i] = inv[i] * inv[i - 1] % mod;
  f[1][1][1] = f[1][0][0] = 1;
  for (int i = 2; i <= n; i++) {
    f[i][0][0] = 1;
    for (int j = 1; j <= i; j++)
      f[i][j][0] = (f[i - 1][j - 1][0] + f[i - 1][j][0] + f[i - 1][j][2]) % mod,
      f[i][j][2] = (f[i - 1][j - 1][1] + f[i - 1][j][1] + f[i - 1][j][3]) % mod,
      f[i][j][1] = (f[i - 1][j - 1][0] + f[i - 1][j - 1][2]) % mod,
      f[i][j][3] = (f[i - 1][j - 1][1] + f[i - 1][j - 1][3]) % mod;
  }
  long long g;
  for (int i = m, F = 1; i <= n; i++) {
    g = F * (f[n][i][0] + f[n][i][2]) * jc[n - i] % mod * C(i, m) % mod + mod;
    (ans += g) %= mod;
    F = -F;
  }
  printf("%lld\n", ans);
  return 0;
}
