//A 10opts
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int MOD=1e9+7;
const int N=1e6+10;

int n,m;
int m2[N];
int ans;

void init(){/*
	jch[1]=jc[1]=1;
	for(int i=2;i<=N-10;++i){
		jc[i]=jc[i-1]*i%MOD;
		jch[i]=jch[i-1]+jc[i];
	}*/
	m2[0]=1;
	for(int i=1;i<=N-10;++i)
		m2[i]=m2[i-1]*2%MOD;
}

signed main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	init();
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=m;++i){
		int sum=i-1;
		ans=(ans+((n-i)*(m2[sum]*m2[m-i]%MOD))%MOD)%MOD;
	}
	ans=(ans+n*m2[m]%MOD)%MOD;
	cout<<ans<<endl;
	return 0;
}
