#include <cstdio>
#include <cstdlib>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define efo(i,q) for(int i=A[q];i;i=B[i][0])
using namespace std;
typedef long long LL;
const int N=2050,mo=1e9+7;
int read(int &n)
{
	char ch=' ';int q=0,w=1;
	for(;(ch!='-')&&((ch<'0')||(ch>'9'));ch=getchar());
	if(ch=='-')w=-1,ch=getchar();
	for(;ch>='0' && ch<='9';ch=getchar())q=q*10+ch-48;n=q*w;return n;
}
int m,n,ans;
int f[N][N],g[N][N];
int fv[N];
int main()
{
	int q,w;	
	read(n),read(m);
	fo(i,1,n)f[1][i]=fv[i]=1,g[1][i]=i-1;
	fo(i,2,n)
	{
		fo(j,i,n)
		{
			((g[i][j]=g[i][j-1]+fv[j-1])>=mo?g[i][j]-=mo:0);
			((f[i][j]=g[i][j-1]+fv[j-1])>=mo?f[i][j]-=mo:0);
			((fv[j-1]+=f[i][j-1])>=mo?fv[j-1]-=mo:0);
		}
	}
	ans=f[m][n];
	fo(i,1,n-m-1)((ans=(ans<<1))>=mo?ans-=mo:0);
	printf("%lld\n",ans);
	return 0;
}