#include<bits/stdc++.h>
#define L long long
#define pb push_back
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
#define aa first
#define bb second
#define mp make_pair
#define mpp(a,b,c) mp(mp(a,b),c)
using namespace std;
const int q=1000000007;
int n,m,f[2010][2010];
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j,k;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
	  f[1][i]=1;
	for(i=2;i<=m;i++)
	  {
	   for(j=1;j<=n-i+1;j++)
	     f[i][j]=f[i-1][j];
	   for(j=n,k=0;j>0;j--)
	     {
		  f[i][j]=(f[i][j]+k)%q;
		  k=(k+f[i-1][j])%q;
		 }
	  }
	for(i=m+1,k=(f[m][1]-f[m-1][1]+q)%q;i<n;i++)
	  k=(k<<1)%q;
	printf("%d\n",k);
	return 0;
}
