#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

const int N=2005,M=4005,P=1e9+7;

int n,k,fac[M],ifac[M],inv[M],a,m,f[N];

inline int catalan(int n){
	return (ll)fac[n<<1]*ifac[n]%P*ifac[n]%P*inv[n+1]%P;
}

int main(){
	scanf("%d%d",&n,&k);
	fac[0]=ifac[0]=1;inv[1]=1;
	for(int i=2;i<=2*n;i++)
		inv[i]=P-(ll)(P/i)*inv[P%i]%P;
	for(int i=1;i<=2*n;i++){
		fac[i]=(ll)fac[i-1]*i%P;
		ifac[i]=(ll)ifac[i-1]*inv[i]%P;
	}
	for(int i=1;i<=n;i++){
		f[i]=catalan(i-1);
		for(int j=2,l=min(i,k+1);j<l;j++)(f[j]+=f[j-1])%=P; 
	}
	a=f[k];m=n-k-1;
	while(m>0)(a<<=1)%=P,m--;
	printf("%d",a); 
	return 0;
}