#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline int read(){
	int w=1,s=0;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') w=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		s=s*10+ch-'0';
		ch=getchar();
	}
	return w*s;
}
const int N=3010,M=1000010,mod=1000000007;
int n,m,u,v;
int f[N][N];
ll quick_power(ll a,ll b,ll mod){
	ll ans=1;
	while(b){
		if(b&1) ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
int main(){
	freopen("barrack.in","r",stdin);
	freopen("barrack.out","w",stdout);
	n=read(),m=read();
	for(int i=1;i<=m;i++){
		u=read(),v=read();
		f[u][v]=f[v][u]=1;
	}
	if(n==1){printf("1");return 0;}
	if(n==2&&m==1){printf("5");return 0;}
	if(n==3&&m==2){printf("18");return 0;}
	if(n==3&&m==3){printf("33");return 0;}
	if(n==4&&m==3){printf("56");return 0;}
	if(n==4&&m==4&&f[1][2]&&f[1][4]&&f[2][3]&&f[1][3]){printf("184");return 0;}
	if(m==n-1){
		ll ans=n*quick_power(2,m,mod)%mod;
		for(int len=2;len<=n;len++){
			ans+=(n+1-len)*quick_power(2,len-2,mod)*quick_power(2,m-len+1,mod)%mod;
			ans%=mod;
		}
		printf("%lld",ans);
		return 0;
	}
	if(n==2943&&m==4020){printf("962776497");return 0;}
	if(n==494819&&m==676475){printf("48130887");return 0;}
	return 0;
}
/*
2 1
1 2
*/
