#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
int n, m;
ll Pow(int k)
{
/*	ll ans = 1;
	for(int i=1;i<=k;i++)
		ans = ans<<1, ans = ans%mod;
*/
	ll a = 2;
	ll ans = 1;
	while(k)
	{
		if(k&1) ans = ans%mod*a%mod;
		a = a*a;
		k = k>>1;
	}
	return ans%mod;
}
int main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%d%d", &n, &m);
//	cout<<n<<" "<<m<<"\n";
	long long ans = 0;
	ans = (ans+n*Pow(m))%mod;
	for(int len=1;len<=m;len++)
	{
		ans = (ans+(n-len)%mod*Pow(m-len)*Pow(len-1))%mod;
	}
	printf("%lld\n", ans);
	return 0;
}
