#include<bits/stdc++.h>
#define reg register
#define ll long long
#define inf 0x3f3f3f3f
#define iinf 0x3f3f3f3f3f3f3f3f
#define lowbit(x) x&(-x)
#define isdigit(ch) (ch>='0'&&ch<='9')
#define P (ll)(pow(10,9)+7)
using namespace std;
ll n,k,f[10001];
inline ll qpow(reg ll a,reg int x)
{
    if(x<0)return 1;
    reg ll s=1;
    while(x)
	{
		if(x&1)
		{
			s*=a;
			s%=P;
		}
		a*=a;
		a%=P;
		x>>=1;
	}
    return s;
}
int main()
{
    scanf("%lld%lld",&n,&k);
    f[0]=1;
    for(reg int i=1;i<n;i++)
    {
		for(reg int j=i;j;j--)
		f[j]=(f[j+1]+f[j-1])%P;
		f[0]=f[1];
	}
    printf("%lld",f[n-k]*qpow(2,n-k-1)%P);
    return 0;
}