#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1e9+7;
int n,m;
int u,v;
ll ans,summ=1,tap,sumi=1;
int main()
{
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;++i)
	{
		scanf("%d%d",&u,&v);
		summ*=2;
		summ%=MOD;
	}
	for(int i=1;i<=n;++i)
	{
		if(i==1)
		{
			tap=(n-i+1)*(summ%MOD)%MOD;
			ans=(ans+tap)%MOD;
			summ/=2;
			continue;
		}
		tap=sumi*(n-i+1)*(summ%MOD)%MOD;
		ans=(ans+tap)%MOD;
		summ/=2;
		sumi*=2;
		sumi%=MOD;
	}
	printf("%lld\n",ans%MOD);
	return 0;
}
