#include<iostream>
#define D(i,a,b) for(int i=a;i>=b;--i)
const int M = 1e9+7;
int f[2005],n,k;
int main(){
	std::cin>>n>>k;f[n+1]=1;
	D(i,n,n-k+1){D(j,n,i+1)f[j]=0;D(j,i,1)f[j]=(f[j]+f[j+1])%M;}
	D(i,n-k-1,1)f[1]=f[1]*2%M;
	std::cout<<f[1];
}