#include<bits/stdc++.h>
using namespace std;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9') f=(ch=='-')?-1:1,ch=getchar();
	while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x*f;
}
int pre[1000010];
int mod=1000000007;
long long ans=0;
int main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	int n=read(),m=read();
	pre[0]=1;
	for(int i=1;i<=n;i++) pre[i]=pre[i-1]*2%mod;
	for(int i=1;i<=n;i++)
		ans+=i*pre[n-i]%mod;
	printf("%d\n",ans%mod);
	return 0;
}