#include<bits/stdc++.h>
using namespace std;
const int e=1e9+7;
long long ans,cnt;
int n,m,u,v,f[500005];
int main()
{
	freopen("barrack.in","r",stdin);
	freopne("barrack.out","w",stdout);
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d",&u,&v);	
	}	
	f[0]=1;
	ans=n;
	for(int i=1;i<=n-1;i++)
	{
		f[i]=f[i-1]*2;
		if(f[i]>e)f[i]-=e;
		ans+=f[i]*(n-i);
		if(ans>e)ans%=e;
	}
	printf("%d",ans);
	return 0;
}
