#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX / 2;
const int Maxn = 1000;
const int Mod = 1000000007;
long long dp[Maxn + 5][Maxn + 5][2][2], n, k;
long long C[Maxn + 5][Maxn + 5], ans[Maxn + 5];
inline void mod_add(long long &x, long long y) {
  x += y;
  if (x > Mod) x -= Mod;
}
int main() {
  cin >> n >> k;
  C[0][0] = 1;
  for (int(i) = (1); (i) <= (n); ++(i)) {
    C[i][0] = 1;
    for (int(j) = (1); (j) <= (i); ++(j))
      mod_add(C[i][j], C[i - 1][j]), mod_add(C[i][j], C[i - 1][j - 1]);
  }
  dp[0][0][1][0] = 1;
  for (int(i) = (1); (i) <= (n); ++(i))
    for (int(j) = (0); (j) <= (i - 1); ++(j))
      for (int(now) = (0); (now) <= (1); ++(now))
        for (int(nxt) = (0); (nxt) <= (1); ++(nxt)) {
          if (!now) mod_add(dp[i][j + 1][nxt][0], dp[i - 1][j][now][nxt]);
          if (i < n) mod_add(dp[i][j + 1][nxt][1], dp[i - 1][j][now][nxt]);
          mod_add(dp[i][j][nxt][0], dp[i - 1][j][now][nxt]);
        }
  for (int(i) = (0); (i) <= (n); ++(i)) {
    for (int(now) = (0); (now) <= (1); ++(now))
      for (int(nxt) = (0); (nxt) <= (1); ++(nxt))
        mod_add(ans[i], dp[n][i][now][nxt]);
    for (int(j) = (2); (j) <= (n - i); ++(j)) ans[i] = ans[i] * j % Mod;
  }
  int flag = -1;
  for (int(i) = (k + 1); (i) <= (n); ++(i)) {
    ans[k] = (ans[k] + flag * C[i][k] * ans[i]) % Mod;
    if (ans[k] < 0) ans[k] += Mod;
    flag *= -1;
  }
  cout << ans[k];
  return 0;
}
