#include <cstdio>
#define MOD 1000000007
typedef long long ll; 
ll dp[2005][2005], ans; 
int main()
{
	// freopen("ARC068-F.in", "r", stdin);
	int n, k; 
	scanf("%d%d", &n, &k); 
	dp[0][n] = 1; 
	for (int i = 0; i < k - 1; i++)
	{
		ll cur = dp[i][n - i]; 
		for (int j = n - i - 1; j >= 1; j--)
		{
			(cur += dp[i][j]) %= MOD; 
			(dp[i + 1][j] += cur) %= MOD; 
		}
	}
	for (int i = 1; i <= n; i++)
		(ans += dp[k - 1][i]) %= MOD; 
	for (int i = 1; i < n - k; i++)
		ans = ans * 2 % MOD; 
	printf("%lld\n", ans);
	return 0; 
}
