#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int mod=1e9+7;
const int maxn=2000;
int n,k;
int f[maxn+8][maxn+8],g[maxn+8][maxn+8];

int read()
{
    int x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}

int power(int a,int k)
{
    if (k<0) return 1;
    int sum=1;
    for (;k;k>>=1,a=1ll*a*a%mod)
    if (k&1)
        sum=1ll*sum*a%mod;
    return sum;
}

int main()
{
    n=read(),k=read();
    g[0][0]=1;
    for (int i=1;i<n;i++)
	{
	    g[i][0]=g[i-1][0];
	    for (int j=1;j<=i;j++)
		    g[i][j]=(g[i][j-1]+g[i-1][j])%mod;
	}
    int ans=g[n-1][k-1];
    ans=1ll*ans*power(2,n-k-1)%mod;
    printf("%d\n",ans);
    return 0;
}

    
