#include<bits/stdc++.h>
using namespace std;
const int N=1e9+7;
int ksm(int a,int b){
	int res=1;
	while(b){
		if(b&1)res=a*res%N;
		a=a*a%N;
		b>>=1;
	}
	return res;
}
int n,m;
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	cin>>n>>m;
	cout<<ksm(2,n-m)%N;
	return 0;
}