#include<bits/stdc++.h>
using namespace std;
#define MAXN	2005
#define P	1000000007
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int dp[MAXN][MAXN], sum[MAXN][MAXN];
int main() {
	int n, k;
	read(n), read(k);
	dp[1][n - k] = 1;
	for (int i = 1; i <= n - k - 1; i++)
		dp[1][n - k] = dp[1][n - k] * 2 % P;
	sum[1][0] = dp[1][0];
	for (int i = 1; i <= n; i++)
		sum[1][i] = (sum[1][i - 1] + dp[1][i]) % P;
	for (int i = 2; i <= n; i++)
	for (int j = 0; j <= n; j++) {
		dp[i][j] = sum[i - 1][j + 1];
		if (j == 0) sum[i][j] = dp[i][j];
		else sum[i][j] = (sum[i][j - 1] + dp[i][j]) % P;
	}
	cout << dp[n][0] << endl;
	return 0;
}