#include<cstdlib>
#include<cstdio>
#include<iostream>
#define ll long long
using namespace std;
const ll P=1e9+7;
ll ksm(ll a,ll b)
{
	ll sum=1;
	while(b>0)
	{
		if(b%2==1) sum*=a;
		a=a*a;
		b/=2;
	}
	return sum;
}
int main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	ll n,m;
	scanf("%lld%lld",&n,&m);
	printf("%lld",((n*ksm(2,m))%P+((n-1)*n/2*ksm(2,m-1))%P)%P);
}