#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define PII pair<int,int>
#define fir first
#define sec second
const int N=5e5+10;
const int mod=1e9+7;
const int INF=1e9+7;

#define wr(i,l,r) for(int i=l;i<=r;i++)
int n,m;
ull f[N],ans=0;

int rd(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}



int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	cin>>n>>m;
	wr(i,1,m){
		int x,y;
		x=rd(),y=rd();
	}
	f[1]=n;
	for(int i=1;i<n;i++){
		f[i+1]=(f[i]*(n-1))/(i+1);
		f[i+1]=f[i+1]%mod;
	}
	for(int i=1;i<=n;i++){
		ull k=(f[i]*(1<<(n-i)))%mod;
		//cout<<f[i]<<endl;
		ans=(ans+k)%mod;
	}
	cout<<ans<<endl;
	return 0;
}