#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
const long long mod = 1000000007;
long long dp[maxn][maxn][2][2];
long long sum[maxn];
long long fac[maxn];
long long a[maxn];
long long c[maxn][maxn];
long long N, K;
void initdp() {
  memset(dp, 0, sizeof(dp));
  dp[1][0][0][0] = 1;
  if (N > 1) dp[1][1][0][1] = 1;
  for (int i = 1; i < N; i++)
    for (int j = 0; j <= i; j++)
      for (int a = 0; a < 2; a++)
        for (int b = 0; b < 2; b++) {
          if (dp[i][j][a][b] == 0) continue;
          int tmp = dp[i][j][a][b];
          dp[i + 1][j][b][0] = (dp[i + 1][j][b][0] + tmp) % mod;
          if (a == 0)
            dp[i + 1][j + 1][b][0] = (dp[i + 1][j + 1][b][0] + tmp) % mod;
          if (i + 2 <= N)
            dp[i + 1][j + 1][b][1] = (dp[i + 1][j + 1][b][1] + tmp) % mod;
        }
  for (int i = 0; i <= N; i++) {
    sum[i] = 0;
    sum[i] = dp[N][i][0][0] + dp[N][i][0][1] + dp[N][i][1][0] + dp[N][i][1][1];
    sum[i] %= mod;
    sum[i] = sum[i] * fac[N - i] % mod;
  }
}
int main() {
  fac[1] = fac[0] = 1;
  for (int i = 2; i <= 1000; i++) fac[i] = fac[i - 1] * i % mod;
  c[0][0] = c[1][0] = c[1][1] = 1;
  for (int i = 2; i <= 1000; i++)
    for (int j = 0; j <= i; j++) {
      c[i][j] = c[i - 1][j - 1];
      if (i - 1 >= j) c[i][j] = (c[i][j] + c[i - 1][j]) % mod;
    }
  while (scanf("%d %d", &N, &K) == 2) {
    initdp();
    a[N] = sum[N];
    for (int i = N - 1; i >= K; i--) {
      long long tmp = sum[i];
      for (int j = i + 1; j <= N; j++) {
        long long mid = c[j][i] * a[j];
        mid %= mod;
        tmp -= mid;
        if (tmp < 0) tmp += mod;
      }
      a[i] = tmp;
    }
    cout << a[K] << endl;
  }
}
